Merge branch 'dbkr/add_brackets' into 'develop'

Add old app name in brackets

See merge request new-vector/element/element-desktop!4
This commit is contained in:
David Baker 2020-07-08 11:01:25 +00:00
commit 9d650eacbb
2 changed files with 12 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "element-desktop", "name": "element-desktop",
"productName": "Element", "productName": "Element (Riot)",
"main": "src/electron-main.js", "main": "src/electron-main.js",
"version": "1.6.6", "version": "1.6.6",
"description": "A feature-rich client for Matrix.org", "description": "A feature-rich client for Matrix.org",

View file

@ -100,13 +100,17 @@ if (argv["help"]) {
} }
// check if we are passed a profile in the SSO callback url // check if we are passed a profile in the SSO callback url
let userDataPath;
const userDataPathInProtocol = getProfileFromDeeplink(argv["_"]); const userDataPathInProtocol = getProfileFromDeeplink(argv["_"]);
if (userDataPathInProtocol) { if (userDataPathInProtocol) {
app.setPath('userData', userDataPathInProtocol); userDataPath = userDataPathInProtocol;
} else if (argv['profile-dir']) { } else if (argv['profile-dir']) {
app.setPath('userData', argv['profile-dir']); userDataPath = argv['profile-dir'];
} else { } else {
let newUserDataPath = app.getPath('userData'); // 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');
if (argv['profile']) { if (argv['profile']) {
newUserDataPath += '-' + argv['profile']; newUserDataPath += '-' + argv['profile'];
} }
@ -123,9 +127,12 @@ if (userDataPathInProtocol) {
console.log(oldUserDataPath + " exists: " + (oldUserDataPathExists ? 'yes' : 'no')); console.log(oldUserDataPath + " exists: " + (oldUserDataPathExists ? 'yes' : 'no'));
if (!newUserDataPathExists && oldUserDataPathExists) { if (!newUserDataPathExists && oldUserDataPathExists) {
console.log("Using legacy user data path: " + oldUserDataPath); console.log("Using legacy user data path: " + oldUserDataPath);
app.setPath('userData', oldUserDataPath); userDataPath = oldUserDataPath;
} else {
userDataPath = newUserDataPath;
} }
} }
app.setPath('userData', userDataPath);
async function tryPaths(name, root, rawPaths) { async function tryPaths(name, root, rawPaths) {
// Make everything relative to root // Make everything relative to root