| 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); |
|---|