Remove unnecessary condition

This commit is contained in:
Dan Stillman 2017-10-07 03:43:02 -04:00
parent 982719bf83
commit d4569d3640

View File

@ -282,29 +282,27 @@ Zotero.DataDirectory = {
throw { name: "NS_ERROR_FILE_NOT_FOUND" }; throw { name: "NS_ERROR_FILE_NOT_FOUND" };
} }
} }
if (nsIFile) { try {
try { let dbFile = OS.Path.join(nsIFile.path, dbFilename);
let dbFile = OS.Path.join(nsIFile.path, dbFilename); let mtime = (yield OS.File.stat(dbFile)).lastModificationDate;
let mtime = (yield OS.File.stat(dbFile)).lastModificationDate; Zotero.debug(`Database found at ${dbFile}, last modified ${mtime}`);
Zotero.debug(`Database found at ${dbFile}, last modified ${mtime}`); // If custom location has a newer DB, use that
// If custom location has a newer DB, use that if (!useProfile || mtime > profileSubdirModTime) {
if (!useProfile || mtime > profileSubdirModTime) { dataDir = nsIFile.path;
dataDir = nsIFile.path; useFirefoxProfileCustom = true;
useFirefoxProfileCustom = true; useProfile = false;
useProfile = false;
}
} }
catch (e) { }
Zotero.logError(e); catch (e) {
// If we have a DB in the Zotero profile and get an error trying to Zotero.logError(e);
// access the custom location in Firefox, use the Zotero profile, since // If we have a DB in the Zotero profile and get an error trying to
// there's at least some chance it's right. Otherwise, throw an error. // access the custom location in Firefox, use the Zotero profile, since
if (!useProfile) { // there's at least some chance it's right. Otherwise, throw an error.
// The error message normally gets the path from the pref, but if (!useProfile) {
// we got it from the prefs file, so include it here // The error message normally gets the path from the pref, but
e.dataDir = nsIFile.path; // we got it from the prefs file, so include it here
throw e; e.dataDir = nsIFile.path;
} throw e;
} }
} }
} }