Skip to content

Commit

Permalink
More installer validation checks
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Dec 17, 2023
1 parent 9302a4f commit bfd0c0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
## Unreleased

### Added
- More installer validation checks for map write access and MPQEditor presence.

### Changed
- Balance tweaks to harvesting logic. (jzy-chitong56)
Expand Down
11 changes: 11 additions & 0 deletions Electron/AMAI-release/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const installOnDirectory = async () => {
process.send(`ERROR: Cannot find ${process.cwd()}\\Scripts\\${ver}\\common.ai`)
return
}
if (!fs.existsSync(`MPQEditor.exe`)) {
process.send(`ERROR: Cannot find ${process.cwd()}\\MPQEditor.exe`)
return
}
if (installCommander && !fs.existsSync(`Scripts\\Blizzard_${ver}.j`)) {
process.send(`ERROR: Cannot find ${process.cwd()}\\Scripts\\blizzard_${ver}.j`)
return
Expand All @@ -68,6 +72,13 @@ const installOnDirectory = async () => {
continue;
}

try {
fs.accessSync(file, fs.constants.W_OK)
} catch (e) {
process.send(`WARN: ${file} does not have write permissions so unable to install`);
continue;
}

try {
// execute same way how InstallTFTtoDir.pl

Expand Down

0 comments on commit bfd0c0c

Please sign in to comment.