From 9b9af65f8ab0e65b6e9d37b2f97564a7e83cfcec Mon Sep 17 00:00:00 2001 From: Dan Stillman <dstillman@zotero.org> Date: Wed, 29 Nov 2017 03:57:09 -0500 Subject: [PATCH] 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. --- chrome/content/zotero/xpcom/profile.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/profile.js b/chrome/content/zotero/xpcom/profile.js index 0bce99af2..8457fb7ac 100644 --- a/chrome/content/zotero/xpcom/profile.js +++ b/chrome/content/zotero/xpcom/profile.js @@ -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 }