Skip to content

Commit

Permalink
Detect installs in ProgramData
Browse files Browse the repository at this point in the history
Fixes #149
  • Loading branch information
zerebos committed Oct 21, 2021
1 parent 68a0556 commit 566c500
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/renderer/actions/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const locations = {stable: "", ptb: "", canary: ""};
const getDiscordPath = function(releaseChannel) {
let resourcePath = "";
if (process.platform === "win32") {
const basedir = path.join(process.env.LOCALAPPDATA, releaseChannel.replace(/ /g, ""));
let basedir = path.join(process.env.LOCALAPPDATA, releaseChannel.replace(/ /g, "")); // Normal install path in AppData\Local
if (!fs.existsSync(basedir)) basedir = path.join(process.env.PROGRAMDATA, process.env.USERNAME, releaseChannel.replace(/ /g, "")); // Atypical location in ProgramData\%username%
if (!fs.existsSync(basedir)) return "";
const version = fs.readdirSync(basedir).filter(f => fs.lstatSync(path.join(basedir, f)).isDirectory() && f.split(".").length > 1).sort().reverse()[0];
if (!version) return "";
Expand Down

0 comments on commit 566c500

Please sign in to comment.