fix: app management in path.helpers.js, used for unit test

This commit is contained in:
MasterAcnolo
2026-10-28 21:49:37 +01:00
parent fdfe30e796
commit ef68484828

View File

@@ -1,6 +1,11 @@
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const { app } = require("electron"); let app;
try {
app = require("electron").app;
} catch (e) {
app = null;
}
const config = require("../../config.js"); const config = require("../../config.js");
/** /**
@@ -18,7 +23,7 @@ const resourcesPath = config.devMode
? path.join(__dirname, "../../resources") ? path.join(__dirname, "../../resources")
: (process.resourcesPath || path.join(__dirname, "../../resources")); : (process.resourcesPath || path.join(__dirname, "../../resources"));
/** Default download folder (centralized) */ /** Default download folder */
const defaultDownloadFolder = app && typeof app.getPath === "function" const defaultDownloadFolder = app && typeof app.getPath === "function"
? path.join(app.getPath("downloads"), "Freedom Loader") ? path.join(app.getPath("downloads"), "Freedom Loader")
: path.join(process.env.HOME || process.cwd(), "Downloads", "Freedom Loader"); : path.join(process.env.HOME || process.cwd(), "Downloads", "Freedom Loader");