Skip to content

Commit

Permalink
fix: Mod migration
Browse files Browse the repository at this point in the history
  • Loading branch information
shuabritze committed Feb 22, 2025
1 parent e0c343d commit 3598bc6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
17 changes: 11 additions & 6 deletions src/mod-download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 3598bc6

Please sign in to comment.