From 36afb34cf652a3bb6599ad2d1e75766d10d37352 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 6 Sep 2018 00:53:50 -0400 Subject: [PATCH] Show warning if Zotero is started from Mac disk image Doing so can cause the Word for Mac extension not to load, and possibly other problems. https://forums.zotero.org/discussion/73470/word-could-not-communicate-with-zotero-with-three-full-uninstalls-and-reinstalls --- chrome/content/zotero/xpcom/zotero.js | 31 ++++++++++++++++++++ chrome/locale/en-US/zotero/zotero.properties | 2 ++ 2 files changed, 33 insertions(+) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 54207fe24a..f798735889 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -231,6 +231,10 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); // Make sure that Zotero Standalone is not running as root if(Zotero.isStandalone && !Zotero.isWin) _checkRoot(); + if (!_checkExecutableLocation()) { + return; + } + try { yield Zotero.DataDirectory.init(); if (this.restarting) { @@ -1753,6 +1757,33 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); } } + function _checkExecutableLocation() { + // Make sure Zotero wasn't started from a Mac disk image, which can cause bundled extensions + // not to load and possibly other problems + if (Zotero.isMac && OS.Constants.Path.libDir.includes('AppTranslocation')) { + 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('general.warning'), + Zotero.getString('startupError.startedFromDiskImage1', Zotero.clientName) + + '\n\n' + + Zotero.getString('startupError.startedFromDiskImage2', Zotero.clientName), + buttonFlags, + Zotero.getString('general.quitApp', Zotero.clientName), + Zotero.getString('general.notNow'), + null, null, {} + ); + if (index === 0) { + Zotero.Utilities.Internal.quit(); + return false; + } + } + + return true; + } + /** * Observer for console messages * @namespace diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 5f1bb678d6..bb30448ff8 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -190,6 +190,8 @@ startupError.zoteroVersionIsOlder.upgrade = Please upgrade to the latest ve startupError.databaseUpgradeError = Database upgrade error startupError.internetFunctionalityMayNotWork = Functionality that depends on an internet connection may not work. startupError.bundledFileUpdateError = %S was unable to load translators and styles. +startupError.startedFromDiskImage1 = %S was started from a disk image, which may break some functionality. +startupError.startedFromDiskImage2 = To install %1$S properly, quit the program, open the disk image you downloaded, and drag ā€œ%1$Sā€ to the alias of the Applications folder shown in the window. Then eject the disk image and launch Zotero by opening it from your Applications folder. date.relative.secondsAgo.one = 1 second ago date.relative.secondsAgo.multiple = %S seconds ago