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
This commit is contained in:
Dan Stillman 2018-09-06 00:53:50 -04:00
parent 4b64cc312c
commit 36afb34cf6
2 changed files with 33 additions and 0 deletions

View file

@ -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

View file

@ -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