From 715193639b2a47c239d4101f9aa527f0f70d9bd4 Mon Sep 17 00:00:00 2001 From: Adomas Ven Date: Tue, 9 Aug 2016 16:59:10 +0100 Subject: [PATCH] Fixes a bug when zotero dir exists elsewhere and you want to select a custom one (#1070) --- chrome/content/zotero/xpcom/zotero.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index c801c53782..9912f362cd 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1116,7 +1116,16 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); var fp = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); fp.init(win, Zotero.getString('dataDir.selectDir'), nsIFilePicker.modeGetFolder); - fp.displayDirectory = Zotero.getZoteroDirectory(); + try { + fp.displayDirectory = Zotero.getZoteroDirectory(); + } catch (e) { + if(e.name == "ZOTERO_DIR_MAY_EXIST") { + fp.displayDirectory = e.dir; + } + else { + throw e; + } + } fp.appendFilters(nsIFilePicker.filterAll); if (fp.show() == nsIFilePicker.returnOK) { var file = fp.file;