Skip to content

Commit

Permalink
fix: export curseforge files correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 authored and dozono committed Oct 25, 2020
1 parent e0bf8c3 commit c836d9c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/main/service/InstanceIOService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,21 @@ export default class InstanceIOService extends Service {
overrides: 'overrides',
};

for (const mod of this.state.instance.mods) {
if (!mod.curseforge) {
// add to override
} else {
curseforgeConfig.files.push({ projectID: mod.curseforge.projectId, fileID: mod.curseforge.fileId, required: true });
}
}

const { task, add, addBuffer, addEmptyDirectory, end } = openCompressedStreamTask(destinationPath);

addEmptyDirectory('overrides');

for (let file of overrides) {
await add(join(instancePath, file), `overrides/${file}`);
if (file.startsWith('mods/')) {
const mod = this.state.instance.mods.find((i) => (i.location.replace('\\', '/') + i.ext) === file);
if (mod && mod.curseforge) {
curseforgeConfig.files.push({ projectID: mod.curseforge.projectId, fileID: mod.curseforge.fileId, required: true });
} else {
await add(join(instancePath, file), `overrides/${file}`);
}
} else {
await add(join(instancePath, file), `overrides/${file}`);
}
}

addBuffer(Buffer.from(JSON.stringify(curseforgeConfig)), 'manifest.json');
Expand Down

0 comments on commit c836d9c

Please sign in to comment.