From 5710fbc530e371c0f47f2b6f6d5756971097c13e Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 3 Jul 2011 00:07:56 +0000 Subject: [PATCH] Don't initialize Zotero just to figure out if Standalone is running --- components/zotero-service.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/components/zotero-service.js b/components/zotero-service.js index 864b793fc..63a7ee224 100644 --- a/components/zotero-service.js +++ b/components/zotero-service.js @@ -298,6 +298,19 @@ ZoteroService.prototype = { Components.interfaces.nsIProtocolHandler]) } +var _isStandalone = null; +/** + * Determine whether Zotero Standalone is running + */ +function isStandalone() { + if(_isStandalone === null) { + var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]. + getService(Components.interfaces.nsIXULAppInfo); + _isStandalone = appInfo.ID === 'zotero@chnm.gmu.edu'; + } + return _isStandalone; +} + /** * The class representing the Zotero command line handler */ @@ -334,7 +347,7 @@ ZoteroCommandLineHandler.prototype = { // special handler for "zotero" URIs at the command line to prevent them from opening a new // window - if(this.Zotero.isStandalone) { + if(isStandalone()) { var param = cmdLine.handleFlagWithParam("url", false); if(param) { var uri = cmdLine.resolveURI(param);