summaryrefslogtreecommitdiff
path: root/src/main/manaplus/manaApp/linux.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/manaplus/manaApp/linux.ts')
-rw-r--r--src/main/manaplus/manaApp/linux.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/main/manaplus/manaApp/linux.ts b/src/main/manaplus/manaApp/linux.ts
index 1a5d828..de48938 100644
--- a/src/main/manaplus/manaApp/linux.ts
+++ b/src/main/manaplus/manaApp/linux.ts
@@ -1,5 +1,4 @@
import { ManaPlusApp } from "./manaApp.interface";
-import { app } from "electron";
import * as fs from "fs-extra";
import { Status } from "../../status";
import { download, Progress as ProgressType } from "../../util/downloader";
@@ -9,16 +8,21 @@ import {
getVersionInfoForPlatform,
updateAvailable,
} from "./shared";
+import {
+ getTempPath,
+ getManaPlusPath,
+ getUserDataPath,
+} from "../../util/app_constants";
+import { join } from "path";
export class ManaPlusAppLinux implements ManaPlusApp {
private path: string;
startCommand: string;
versionRegEx: RegExp = /.*ManaPlus ([\d.]+) Linux.*/g; //TODO
constructor() {
- const ManaPath = app.getPath("userData") + "/manaplus";
+ const ManaPath = getManaPlusPath();
fs.existsSync(ManaPath) || fs.mkdirSync(ManaPath);
- fs.existsSync(app.getPath("userData") + "/temp") ||
- fs.mkdirSync(app.getPath("userData") + "/temp");
+ fs.existsSync(getTempPath()) || fs.mkdirSync(getTempPath());
this.path = ManaPath;
this.startCommand = ManaPath + "/Mana.AppImage";
}
@@ -38,8 +42,7 @@ export class ManaPlusAppLinux implements ManaPlusApp {
return updateAvailable("AppImage", this);
}
async update(): Promise<any> {
- fs.existsSync(app.getPath("userData") + "/temp") ||
- fs.mkdirSync(app.getPath("userData") + "/temp");
+ fs.existsSync(getTempPath()) || fs.mkdirSync(getTempPath());
// Get Update URL
Status.setProgress(500);
Status.setProgress(-1);
@@ -58,9 +61,10 @@ export class ManaPlusAppLinux implements ManaPlusApp {
}
Status.setProgress(-1);
- const updateDestination: string = `${app.getPath(
- "userData"
- )}/temp/update.AppImage`;
+ const updateDestination: string = join(
+ getUserDataPath(),
+ "/temp/update.AppImage"
+ );
try {
await download(downloadURL, updateDestination, (state: ProgressType) => {