From e34bf4d5cbb794f12fbeb05f4316576283583c7a Mon Sep 17 00:00:00 2001
From: Dan Stillman <dstillman@zotero.org>
Date: Sat, 17 Dec 2016 07:42:03 -0500
Subject: [PATCH] Prompt to try manual data dir migration again if Firefox is
 open

---
 chrome/content/zotero/xpcom/dataDirectory.js | 19 +++++++++++++++++++
 chrome/locale/en-US/zotero/zotero.properties |  1 +
 2 files changed, 20 insertions(+)

diff --git a/chrome/content/zotero/xpcom/dataDirectory.js b/chrome/content/zotero/xpcom/dataDirectory.js
index cd1c89ade..07f7176d0 100644
--- a/chrome/content/zotero/xpcom/dataDirectory.js
+++ b/chrome/content/zotero/xpcom/dataDirectory.js
@@ -506,6 +506,25 @@ Zotero.DataDirectory = {
 			let foundPipe = yield Zotero.IPC.pipeExists();
 			if (foundPipe) {
 				Zotero.debug("Found existing pipe -- skipping migration");
+				
+				if (!automatic) {
+					let ps = Services.prompt;
+					let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+						+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING);
+					let index = ps.confirmEx(null,
+						Zotero.getString('dataDir.migration.failure.title'),
+						Zotero.getString('dataDir.migration.failure.full.firefoxOpen'),
+						buttonFlags,
+						Zotero.getString('general.tryAgain'),
+						Zotero.getString('general.tryLater'),
+						null, null, {}
+					);
+					
+					if (index == 0) {
+						return this.checkForMigration(newDir, newDir);
+					}
+				}
+				
 				return false;
 			}
 		}
diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties
index 1bca23f0e..bb5f6fe1a 100644
--- a/chrome/locale/en-US/zotero/zotero.properties
+++ b/chrome/locale/en-US/zotero/zotero.properties
@@ -147,6 +147,7 @@ dataDir.migration.failure.full.automatic.text1 = %S attempted to move your data
 dataDir.migration.failure.full.automatic.text2 = It is recommended that you close %S and move your data directory manually.
 dataDir.migration.failure.full.manual.text1 = Your %S data directory could not be migrated.
 dataDir.migration.failure.full.manual.text2 = It is recommended that you close %S and manually move your data directory to the new default location.
+dataDir.migration.failure.full.firefoxOpen = Your data directory cannot be migrated while Zotero for Firefox is open. Please close Firefox and try again.
 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