Don't show Firefox profile access message on empty 'zotero' dir

But maybe do show in cases where it didn't show before, since we were
using exists(), which can return false for inaccessible directories.
This commit is contained in:
Dan Stillman 2017-11-29 03:57:09 -05:00
parent e2eef779c5
commit 9b9af65f8a

View File

@ -213,14 +213,14 @@ Zotero.Profile = {
await Zotero.File.getContentsAsync(prefsFile);
let dir = OS.Path.join(profileDir, Zotero.DataDirectory.legacyDirName);
Zotero.debug("Checking for 'zotero' subdirectory");
if (await OS.File.exists(dir)) {
if ((await OS.File.stat(dir)).isDir) {
let dbFilename = Zotero.DataDirectory.getDatabaseFilename();
let dbFile = OS.Path.join(dir, dbFilename);
Zotero.debug("Checking database access within 'zotero' subdirectory");
(await OS.File.stat(dbFile)).lastModificationDate;
}
else {
Zotero.debug("'zotero' subdirectory not found");
Zotero.debug("'zotero' is not a directory!");
}
}
else {
@ -228,6 +228,9 @@ Zotero.Profile = {
}
}
catch (e) {
if (e instanceof OS.File.Error && e.becauseNoSuchFile) {
return true;
}
Zotero.debug(e, 2)
return false
}