Don't keep checking for lost Z4Fx data directory

This commit is contained in:
Dan Stillman 2017-08-19 23:47:10 +02:00
parent f45d56113a
commit 2919486818

View file

@ -550,7 +550,7 @@ Zotero.DataDirectory = {
checkForLostLegacy: async function () { checkForLostLegacy: async function () {
var currentDir = this.dir; var currentDir = this.dir;
if (currentDir != this.defaultDir) return; if (currentDir != this.defaultDir) return;
if (Zotero.Prefs.get('ignoreLegacyDataDir')) return; if (Zotero.Prefs.get('ignoreLegacyDataDir.auto') || Zotero.Prefs.get('ignoreLegacyDataDir.explicit')) return;
try { try {
let profilesParent = OS.Path.dirname(Zotero.Profile.getOtherAppProfilesDir()); let profilesParent = OS.Path.dirname(Zotero.Profile.getOtherAppProfilesDir());
Zotero.debug("Looking for Firefox profile in " + profilesParent); Zotero.debug("Looking for Firefox profile in " + profilesParent);
@ -578,16 +578,19 @@ Zotero.DataDirectory = {
let info = await OS.File.stat(dbFile); let info = await OS.File.stat(dbFile);
if (info.size < 1200000) { if (info.size < 1200000) {
Zotero.debug(`Legacy database is ${info.size} bytes -- ignoring`); Zotero.debug(`Legacy database is ${info.size} bytes -- ignoring`);
Zotero.Prefs.set('ignoreLegacyDataDir.auto', true);
return; return;
} }
mtime = info.lastModificationDate; mtime = info.lastModificationDate;
if (mtime < new Date(2017, 6, 1)) { if (mtime < new Date(2017, 6, 1)) {
Zotero.debug(`Legacy database was last modified on ${mtime.toString()} -- ignoring`); Zotero.debug(`Legacy database was last modified on ${mtime.toString()} -- ignoring`);
Zotero.Prefs.set('ignoreLegacyDataDir.auto', true);
return; return;
} }
Zotero.debug(`Legacy database found at ${dbFile}, last modified ${mtime}`); Zotero.debug(`Legacy database found at ${dbFile}, last modified ${mtime}`);
} }
catch (e) { catch (e) {
Zotero.Prefs.set('ignoreLegacyDataDir.auto', true);
if (e.becauseNoSuchFile) { if (e.becauseNoSuchFile) {
return; return;
} }
@ -620,7 +623,7 @@ Zotero.DataDirectory = {
return; return;
} }
if (dontAskAgain.value) { if (dontAskAgain.value) {
Zotero.Prefs.set('ignoreLegacyDataDir', true); Zotero.Prefs.set('ignoreLegacyDataDir.explicit', true);
} }
if (index == 0) { if (index == 0) {
return; return;