commit 06ad369368a0bec62f1cb63e3b03bb250ea72630
parent d88cfc6c5f95796dc6cf885665c9f3623f7a9b8f
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 16 Nov 2016 00:37:24 -0500
Create database when new data dir location is set in pref
Regression from new data directory handling
Diffstat:
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -271,6 +271,8 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
// Make sure that Zotero Standalone is not running as root
if(Zotero.isStandalone && !Zotero.isWin) _checkRoot();
+ _addToolbarIcon();
+
try {
var dataDir = Zotero.getZoteroDirectory();
}
@@ -955,10 +957,6 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
throw (e);
}
this.setDataDirectory(file.path);
- if (!file.exists()) {
- var e = { name: "NS_ERROR_FILE_NOT_FOUND" };
- throw (e);
- }
}
else {
// If there's a migration marker in this directory and no database, migration was
@@ -991,6 +989,17 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
}
}
}
+
+ if (!file.exists()) {
+ // If useDataDir is set to ~/Zotero and it doesn't exist, create it
+ if (file.path == this.getDefaultDataDir()) {
+ Zotero.File.createDirectoryIfMissing(file);
+ }
+ else {
+ let e = { name: "NS_ERROR_FILE_NOT_FOUND" };
+ throw e;
+ }
+ }
}
else {
let dataDir = this.getDefaultDataDir();