Changeset 715

Show
Ignore:
Timestamp:
04/04/08 20:21:38 (8 months ago)
Author:
aranti..@gmail.com
Message:

Fixes #93

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/chrome/chromeFiles/content/utils.js

    r712 r715  
    169169 
    170170function launchApplicationWithDoc(appFile, docFile) { 
     171  var args=[docFile.path]; 
     172 
     173  // For the mac, wrap with a call to "open". 
    171174  var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"] 
    172175                             .getService(Components.interfaces.nsIXULRuntime); 
    173   // See Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=411819 
    174   // TODO: remove this when nsIMIMEInfo works on windows again. 
    175   if (xulRuntime.OS.toLowerCase().substring(0, 3) == "win") { 
    176     var process = Components.classes["@mozilla.org/process/util;1"] 
    177                             .createInstance(Components.interfaces.nsIProcess); 
    178     process.init(appFile); 
    179     process.run(false, // blocking 
    180                 [docFile.path], // args 
    181                 1); // number of args 
    182   } else { 
    183     var mimeInfoService = 
    184         Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"] 
    185                   .getService(Components.interfaces.nsIMIMEService); 
    186     var mimeInfo = mimeInfoService.getFromTypeAndExtension( 
    187         "application/x-userscript+javascript", "user.js" ); 
    188     mimeInfo.preferredAction = mimeInfo.useHelperApp; 
    189     mimeInfo.preferredApplicationHandler = appFile; 
    190     mimeInfo.launchWithFile(docFile); 
    191   } 
     176  if ("Darwin"==xulRuntime.OS) { 
     177    args=["-a", appFile.path, docFile.path] 
     178 
     179    appFile = Components.classes["@mozilla.org/file/local;1"] 
     180                        .createInstance(Components.interfaces.nsILocalFile); 
     181    appFile.followLinks = true; 
     182    appFile.initWithPath("/usr/bin/open"); 
     183  } 
     184 
     185  var process = Components.classes["@mozilla.org/process/util;1"] 
     186                          .createInstance(Components.interfaces.nsIProcess); 
     187  process.init(appFile); 
     188  process.run(false, args, args.length); 
    192189} 
    193190