Fixes a bug when zotero dir exists elsewhere and you want to select a custom one (#1070)

This commit is contained in:
Adomas Ven 2016-08-09 16:59:10 +01:00 committed by Dan Stillman
parent ef9f727adf
commit 715193639b

View file

@ -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;