diff --git a/src/main/services/installation-location.service.ts b/src/main/services/installation-location.service.ts index 7445ba2a..d227922b 100644 --- a/src/main/services/installation-location.service.ts +++ b/src/main/services/installation-location.service.ts @@ -2,6 +2,8 @@ import path from "path"; import { app } from "electron"; import ElectronStore from "electron-store"; import { copyDirectoryWithJunctions, deleteFolder, ensureFolderExist, pathExist } from "../helpers/fs.helpers"; +import { tryit } from "../../shared/helpers/error.helpers"; +import { pathExistsSync } from "fs-extra"; export class InstallationLocationService { private static instance: InstallationLocationService; @@ -67,8 +69,8 @@ export class InstallationLocationService { return this.installPathConfig.get(this.STORE_INSTALLATION_PATH_KEY) as string; } - const oldPath = path.join(app.getPath("documents"), this.INSTALLATION_FOLDER); - if(await pathExist(oldPath)){ + const { result: oldPath } = tryit(() => path.join(app.getPath("documents"), this.INSTALLATION_FOLDER)); + if(oldPath && pathExistsSync(oldPath)){ return app.getPath("documents"); }