From 9d15c1bbd03ecd1de3daf28e17631cca9715580a Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 15 Jul 2020 20:21:06 +0100 Subject: [PATCH] Don't forget nightly when computing userData path We were assuming we were always 'Element' --- src/electron-main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/electron-main.js b/src/electron-main.js index f8dcc1b..bfa5397 100644 --- a/src/electron-main.js +++ b/src/electron-main.js @@ -115,14 +115,18 @@ if (userDataPathInProtocol) { } else if (argv['profile-dir']) { userDataPath = argv['profile-dir']; } else { + // strip the bracketed riot suffix from the app name, if any: we don't want to + // store user data in a dir with that transitional suffix. + const appName = app.getName().replace(' (Riot)', ''); + // always override the user data path because electron uses the ${appData}/productName // but we want our productName to be "Element (Riot)" for a transition period after the rename. - let newUserDataPath = path.join(app.getPath('appData'), 'Element'); + let newUserDataPath = path.join(app.getPath('appData'), appName); if (argv['profile']) { newUserDataPath += '-' + argv['profile']; } const newUserDataPathExists = isRealUserDataDir(newUserDataPath); - const oldUserDataPath = path.join(app.getPath('appData'), 'Riot'); + const oldUserDataPath = path.join(app.getPath('appData'), appName.replace('Element', 'Riot')); const oldUserDataPathExists = isRealUserDataDir(oldUserDataPath); console.log(newUserDataPath + " exists: " + (newUserDataPathExists ? 'yes' : 'no')); console.log(oldUserDataPath + " exists: " + (oldUserDataPathExists ? 'yes' : 'no'));