feat: create SystemPath class to prevent Hydra not opening when some user folders are not correctly set on windows

This commit is contained in:
Zamitto
2025-04-30 12:10:26 -03:00
parent 6068d70aeb
commit f52f0ca614
11 changed files with 79 additions and 23 deletions

View File

@@ -1,23 +1,24 @@
import { app } from "electron";
import path from "node:path";
import { SystemPath } from "./services/system-path";
export const LUDUSAVI_MANIFEST_URL = "https://cdn.losbroxas.org/manifest.yaml";
export const defaultDownloadsPath = app.getPath("downloads");
export const defaultDownloadsPath = SystemPath.getPath("downloads");
export const isStaging = import.meta.env.MAIN_VITE_API_URL.includes("staging");
export const levelDatabasePath = path.join(
app.getPath("userData"),
SystemPath.getPath("userData"),
`hydra-db${isStaging ? "-staging" : ""}`
);
export const commonRedistPath = path.join(
app.getPath("userData"),
SystemPath.getPath("userData"),
"CommonRedist"
);
export const logsPath = path.join(app.getPath("userData"), "logs");
export const logsPath = path.join(SystemPath.getPath("userData"), "logs");
export const seedsPath = app.isPackaged
? path.join(process.resourcesPath, "seeds")
@@ -27,7 +28,7 @@ export const achievementSoundPath = app.isPackaged
? path.join(process.resourcesPath, "achievement.wav")
: path.join(__dirname, "..", "..", "resources", "achievement.wav");
export const backupsPath = path.join(app.getPath("userData"), "Backups");
export const backupsPath = path.join(SystemPath.getPath("userData"), "Backups");
export const appVersion = app.getVersion() + (isStaging ? "-staging" : "");