diff --git a/package.json b/package.json index 636d893..f5e5015 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mushroom-launcher", "productName": "Mushroom Launcher", - "version": "1.2.1", + "version": "1.2.2", "description": "Mushhroom Game Launcher", "main": ".vite/build/main.js", "private": true, diff --git a/src/mod-download.ts b/src/mod-download.ts index 1339d2c..457dad6 100644 --- a/src/mod-download.ts +++ b/src/mod-download.ts @@ -13,14 +13,19 @@ export const GetModDirectory = () => { const appDataPath = app.getPath("userData"); // Migrate old mods - if (fs.existsSync(path.join(path.dirname(process.execPath), "../mods"))) { - fs.copyFileSync( - path.join(path.dirname(process.execPath), "../mods"), + const oldDir = path.join( + path.dirname(process.execPath), + app.isPackaged ? "../mods" : "../../../mods", + ); + if (fs.existsSync(oldDir)) { + // Copy the old mods directory to the new location + fs.cpSync(oldDir, path.join(appDataPath, "mods"), { recursive: true }); + fs.rmSync(oldDir, { recursive: true }); + + logger.info( + "Migrated old mods to new location: ", path.join(appDataPath, "mods"), ); - fs.rmdirSync(path.join(path.dirname(process.execPath), "../mods")); - - logger.info("Migrated old mods to new location: ", path.join(appDataPath, "mods")); } const dir = path.join(appDataPath, "mods");