From 99152d78e5cb1d6d4be2ea2bf0b6acc77ce88545 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 26 Dec 2016 17:09:29 -0500 Subject: [PATCH] Fix file handling when Zotero is launched from close on Windows When opening CSL, BibTeX, etc. --- components/zotero-service.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/components/zotero-service.js b/components/zotero-service.js index 2be849a88a..358c4132e3 100644 --- a/components/zotero-service.js +++ b/components/zotero-service.js @@ -461,6 +461,22 @@ function isStandalone() { return _isStandalone; } +function getOS() { + return Services.appinfo.OS; +} + +function isMac() { + return getOS() == "Darwin"; +} + +function isWin() { + return getOS() == "WINNT"; +} + +function isLinux() { + return getOS() == "Linux"; +} + /** * The class representing the Zotero command line handler */ @@ -541,11 +557,11 @@ ZoteroCommandLineHandler.prototype = { // In Fx49-based Mac Standalone, if Zotero is closed, an associated file is launched, and // Zotero hasn't been opened before, a -file parameter is passed and two main windows open. // Subsequent file openings when closed result in -url with file:// URLs (converted above) - // and don't result in two windows. + // and don't result in two windows. Here we prevent the double window. param = fileToOpen; if (!param) { param = cmdLine.handleFlagWithParam("file", false); - if (param) { + if (param && isMac()) { cmdLine.preventDefault = true; } }