Skip to content

Commit

Permalink
GC3fix: mods installed in wrong path when crusade expansion present
Browse files Browse the repository at this point in the history
- Removed pointless setup function
- Version bumped because semver hates 0.0.x

fixes Nexus-Mods/Vortex#8394
  • Loading branch information
IDCs committed Jan 26, 2021
1 parent d5e22bb commit aa642ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
32 changes: 10 additions & 22 deletions game-galciv3/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ function dirExists(dirPath) {
.catch(() => Promise.resolve(false));
}

function prepareForModding(api) {
const missingModPath = () => {
api.sendNotification({
type: 'error',
title: 'Missing mods path',
message: 'Please run the game at least once',
})
return Promise.reject(new util.ProcessCanceled('Mods directory doesn\'t exist'));
};
const defaultModFolder = path.join(modPath(), 'Factions');
const crusadeModFolder = path.join(crusadeModPath(), 'Factions');
return Promise.all([dirExists(defaultModFolder), dirExists(crusadeModFolder)])
.then(res => (res[0] || res[1])
? Promise.resolve()
: missingModPath());
}

function installContent(files) {
// We rely on mod authors to properly pack their mods and include.
// the mod folder within the archive
Expand All @@ -67,7 +50,6 @@ function installContent(files) {
const filtered = files.filter(file => !file.endsWith(path.sep));
const factionFiles = filtered.filter(file => file.endsWith(FACTION_EXT));
const nonFactionFiles = filtered.filter(file => !file.endsWith(FACTION_EXT));

const instructions = nonFactionFiles.map(file => {
return {
type: 'copy',
Expand Down Expand Up @@ -100,13 +82,20 @@ function main(context) {
name: 'Galactic Civilizations III',
mergeMods: true,
queryPath: findGame,
queryModPath: modPath,
queryModPath: () => {
const crusadePath = crusadeModPath();
try {
fs.statSync(crusadePath);
return crusadePath;
} catch (err) {
return modPath();
}
},
logo: 'gameart.jpg',
executable: () => 'GalCiv3.exe',
requiredFiles: [
'GalCiv3.exe',
],
setup: () => prepareForModding(context.api),
environment: {
SteamAPPId: STEAM_ID.toString(),
},
Expand All @@ -117,8 +106,7 @@ function main(context) {

context.registerInstaller('galciv3installer', 25, testSupportedContent, installContent);
context.registerModType('galciv3crusade', 25, (gameId) => (gameId === GAME_ID),
() => crusadeModPath(), (instructions) => dirExists(path.join(crusadeModPath(), 'Factions'))
.then(res => Promise.resolve(res)));
() => crusadeModPath(), () => dirExists(crusadeModPath()));

context.once(() => {
let displayNotification = false;
Expand Down
2 changes: 1 addition & 1 deletion game-galciv3/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Game: Galactic Civilizations III",
"author": "Black Tree Gaming Ltd.",
"version": "0.0.1",
"version": "0.1.0",
"description": "Support for Galactic Civilizations III"
}

0 comments on commit aa642ca

Please sign in to comment.