Skip to content

Commit

Permalink
fix: deployment on export
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Aug 11, 2019
1 parent b132200 commit bbeafb6
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/main/store/modules/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,18 +462,13 @@ const mod = {
});

const modsDir = paths.resolve(srcFolderPath, 'mods');
const forgeMods = [];
const litesMods = [];
const mods = [];
if (await fs.exists(modsDir)) {
for (const file of await fs.readdir(modsDir)) {
try {
const resource = await context.dispatch('waitTask', await context.dispatch('importResource', { path: paths.resolve(srcFolderPath, 'mods', file) }));
if (resource) {
if (resource.domain === 'mods') {
forgeMods.push(getModIdentifier(resource));
} else if (resource.type === 'liteloader') {
litesMods.push(getModIdentifier(resource));
}
mods.push(resource.hash);
}
} catch (e) {
console.error(`Cannot import mod at ${file}.`);
Expand All @@ -499,18 +494,11 @@ const mod = {
profileTemplate = await fs.readFile(proiflePath).then(buf => buf.toString()).then(JSON.parse, () => ({}));
Reflect.deleteProperty(profileTemplate, 'java');

if (!profileTemplate.forge) {
profileTemplate.forge = {
mods: forgeMods,
if (!profileTemplate.deployments) {
profileTemplate.deployments = {
mods,
};
}
if (!profileTemplate.forge.mods) profileTemplate.forge.mods = forgeMods;
if (!profileTemplate.liteloader) {
profileTemplate.liteloader = {
mods: litesMods,
};
}
if (!profileTemplate.liteloader.mods) profileTemplate.liteloader.mods = litesMods;
}

await fs.writeFile(context.rootGetters.path('profiles', id, 'profile.json'), JSON.stringify(profileTemplate, null, 4));
Expand Down

0 comments on commit bbeafb6

Please sign in to comment.