Merge pull request #120 from vector-im/dbkr/userdata_support_nightly

Don't forget nightly when computing userData path
This commit is contained in:
David Baker 2020-07-16 09:55:09 +01:00 committed by GitHub
commit 180710f54c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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'));