commit 98e3a9addf2afc8d83cd01932d8af6f0e11a56cb
parent 0668faa584e05d58d309465796df439e515a24ae
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 21 Nov 2016 04:54:01 -0500
Allow immediate retry on partial data dir migration failure
A common cause of this on Windows will likely be open attachment files,
so suggest closing those and make retrying the default action.
Diffstat:
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -1528,7 +1528,8 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
if (errors.length) {
let ps = Services.prompt;
let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
- + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING);
+ + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
+ + (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING);
let index = ps.confirmEx(null,
Zotero.getString('dataDir.migration.failure.title'),
Zotero.getString('dataDir.migration.failure.partial.text',
@@ -1538,13 +1539,17 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
+ "\n\n"
+ Zotero.getString('dataDir.migration.failure.partial.new', newDir),
buttonFlags,
+ Zotero.getString('general.tryAgain'),
+ Zotero.getString('general.tryLater'),
Zotero.getString('dataDir.migration.failure.partial.showDirectoriesAndQuit', Zotero.appName),
- Zotero.getString('general.notNow'),
- null, null, {}
+ null, {}
);
- // Focus the first file/folder in the old directory
if (index == 0) {
+ return this.checkForDataDirectoryMigration(newDir, newDir);
+ }
+ // Focus the first file/folder in the old directory
+ else if (index == 2) {
try {
let it = new OS.File.DirectoryIterator(oldDir);
let entry;
diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties
@@ -57,6 +57,8 @@ general.keys.ctrlShift = Ctrl+Shift+
general.keys.cmdShift = Cmd+Shift+
general.dontShowAgain = Don’t Show Again
general.fix = Fix…
+general.tryAgain = Try Again
+general.tryLater = Try Later
general.operationInProgress = A Zotero operation is currently in progress.
general.operationInProgress.waitUntilFinished = Please wait until it has finished.
@@ -134,15 +136,15 @@ dataDir.incompatibleDbVersion.title = Incompatible Database Version
dataDir.incompatibleDbVersion.text = The currently selected data directory is not compatible with Zotero Standalone, which can share a database only with Zotero for Firefox 2.1b3 or later.\n\nUpgrade to the latest version of Zotero for Firefox first or select a different data directory for use with Zotero Standalone.
dataDir.migration.inProgress = Migration in progress — do not interrupt…
dataDir.migration.failure.title = Data Directory Migration Error
-dataDir.migration.failure.partial.text = Some files in your old %1$S data directory could not be transferred to the new location. You should close %2$S and attempt to move the remaining files manually.
+dataDir.migration.failure.partial.text = Some files in your old %1$S data directory could not be transferred to the new location. Close any open attachment files and try again. You can also quit %2$S and attempt to move the remaining files manually.
dataDir.migration.failure.partial.old = Old directory: %S
dataDir.migration.failure.partial.new = New directory: %S
-dataDir.migration.failure.partial.showDirectoriesAndQuit = Show Directories and Quit %S
+dataDir.migration.failure.partial.showDirectoriesAndQuit = Show Directories and Quit
dataDir.migration.failure.full.text1 = Your data directory could not be migrated.
dataDir.migration.failure.full.text2 = It is recommended that you close %S and manually move your data directory to the new default location.
dataDir.migration.failure.full.current = Current location: %S
dataDir.migration.failure.full.recommended = Recommended location: %S
-dataDir.migration.failure.full.showCurrentDirectoryAndQuit = Show Current Directory and Quit %S
+dataDir.migration.failure.full.showCurrentDirectoryAndQuit = Show Current Directory and Quit
app.standalone = Zotero Standalone
app.firefox = Zotero for Firefox
diff --git a/test/tests/zoteroTest.js b/test/tests/zoteroTest.js
@@ -158,11 +158,14 @@ describe("Zotero Core Functions", function () {
let stub4 = sinon.stub(Zotero.File, "reveal").returns(Zotero.Promise.resolve());
let stub5 = sinon.stub(Zotero.Utilities.Internal, "quitZotero");
- var promise = waitForDialog();
+ var promise2;
+ // Click "Try Again" the first time, and then "Show Directories and Quit Zotero"
+ var promise = waitForDialog(function () {
+ promise2 = waitForDialog(null, 'extra1');
+ });
yield Zotero.checkForDataDirectoryMigration(oldDir, newDir);
- Zotero.debug("Waiting for dialog");
yield promise;
- Zotero.debug("Done waiting for dialog");
+ yield promise2;
assert.isTrue(stub4.calledTwice);
assert.isTrue(stub4.getCall(0).calledWith(oldStorageDir));