Fix display of data dir in migration error message

When migrating prefs from Zotero for Firefox, the prefs specified a
custom data dir, and that directory was missing, the "Previous
directory:" line was blank.
This commit is contained in:
Dan Stillman 2017-09-14 18:49:01 -04:00
parent 9395af86f7
commit 18c62be6a4
2 changed files with 10 additions and 3 deletions

View file

@ -300,6 +300,9 @@ Zotero.DataDirectory = {
// access the custom location in Firefox, use the Zotero profile, since
// there's at least some chance it's right. Otherwise, throw an error.
if (!useProfile) {
// The error message normally gets the path from the pref, but
// we got it from the prefs file, so include it here
e.dataDir = nsIFile.path;
throw e;
}
}

View file

@ -313,7 +313,9 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
Zotero.logError(e);
}
let previousDir = Zotero.Prefs.get('lastDataDir') || Zotero.Prefs.get('dataDir');
let previousDir = Zotero.Prefs.get('lastDataDir')
|| Zotero.Prefs.get('dataDir')
|| e.dataDir;
Zotero.startupError = foundInDefault
? Zotero.getString(
'dataDir.notFound.defaultFound',
@ -357,8 +359,10 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
else {
let index = ps.confirmEx(null,
Zotero.getString('general.error'),
Zotero.startupError + '\n\n' +
Zotero.getString('dataDir.previousDir') + ' ' + previousDir,
Zotero.startupError
+ (previousDir
? '\n\n' + Zotero.getString('dataDir.previousDir') + ' ' + previousDir
: ''),
buttonFlags,
Zotero.getString('general.quit'),
Zotero.getString('dataDir.useDefaultLocation'),