diff --git a/app/main.js b/app/main.js index 8f6efd0..3810271 100644 --- a/app/main.js +++ b/app/main.js @@ -25,9 +25,6 @@ const storage = require("./lib/storageMain") const toc = require("./lib/tocMain") const zoom = require("./lib/zoomMain") -const DATA_DIR_FILE = ".datadir" -const USER_DATA_PLACEHOLDER = "MDVIEW_USER_DATA" - const MIN_WINDOW_WIDTH = 200 // Pixels const MIN_WINDOW_HEIGHT = 50 // Pixels const UPDATE_INTERVAL = 1000 // ms @@ -601,14 +598,12 @@ if (cli.isDevelopment()) { "userData", path.join(path.resolve(args.slice(1).find(arg => !arg.startsWith("-"))), ".data"), ) -} else if (process.platform === "win32") { - const dataPath = fs.readFileSync(path.join(appDir, DATA_DIR_FILE), { encoding: "utf-8" }).trim() - if (dataPath !== USER_DATA_PLACEHOLDER) { - electron.app.setPath( - "userData", - path.isAbsolute(dataPath) ? dataPath : path.join(appDir, ".data"), - ) - } +} else if ( + process.platform === "win32" && + !appDir.startsWith(process.env.ProgramFiles) && + !appDir.startsWith(process.env.LOCALAPPDATA) +) { + electron.app.setPath("userData", path.join(appDir, ".data")) } // If set, ouput only paths and exit diff --git a/build/assets/.datadir b/build/assets/.datadir deleted file mode 100644 index ea26ec2..0000000 --- a/build/assets/.datadir +++ /dev/null @@ -1 +0,0 @@ -.data diff --git a/build/deployConfig.js b/build/deployConfig.js index 1744309..7921c6d 100644 --- a/build/deployConfig.js +++ b/build/deployConfig.js @@ -33,7 +33,6 @@ module.exports = { allowElevation: true, allowToChangeInstallationDirectory: true, createDesktopShortcut: false, - include: "build/installer.nsh", license: "LICENSE", oneClick: false, perMachine: false, diff --git a/build/installer.nsh b/build/installer.nsh deleted file mode 100644 index ce727f9..0000000 --- a/build/installer.nsh +++ /dev/null @@ -1,7 +0,0 @@ -!macro customInstall - Push $0 - FileOpen $0 "$INSTDIR\.datadir" w - FileWrite $0 "MDVIEW_USER_DATA" - FileClose $0 - Pop $0 -!macroend