commit 18c62be6a49a3e17b8dd251319fedbfbac5d996b
parent 9395af86f76c71883a766986e91ec3b2cc025846
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 14 Sep 2017 18:49:01 -0400
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.
Diffstat:
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/xpcom/dataDirectory.js b/chrome/content/zotero/xpcom/dataDirectory.js
@@ -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;
}
}
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -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'),