From 18c62be6a49a3e17b8dd251319fedbfbac5d996b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 14 Sep 2017 18:49:01 -0400 Subject: [PATCH] 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. --- chrome/content/zotero/xpcom/dataDirectory.js | 3 +++ chrome/content/zotero/xpcom/zotero.js | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/dataDirectory.js b/chrome/content/zotero/xpcom/dataDirectory.js index ec6038f78..d080d2244 100644 --- 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 index 7057ddcb2..47ca034e3 100644 --- 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'),