In my addon I was launching Firefox profiles by doing this:
var exe = FileUtils.getFile('XREExeF', []); //this gives path to executable
var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
process.init(exe);
var args = ['-P', profName, '-no-remote']; //-new-instance
if (url) {
args.push('about:home');
args.push(url);
}
process.run(false, args, args.length);
So this adds command line arguments and launches it. However this leads to some problems. Users want to pin the icon and it just pins another firefox.exe
. Users also try to change the icon.
Wikipedia says all OS support shortcuts: http://en.wikipedia.org/wiki/File_shortcut
So I wanted to copy XREExeF
and paste it as a shortcut and then add command line arguments to it.
Edit: Thanks to @nmaier I now know there is no cross-os method. Can you please show me os specific methods.
In this example the shortcut created will be called "Mozilla Firef ya" and will open up a profile named "ya ya".
Cu.import('resource://gre/modules/FileUtils.jsm');
var exe = FileUtils.getFile('XREExeF', []);
var myShortcut = FileUtils.getFile('Desk', ['Mozilla Firef ya.lnk']);
var myShortcutWin = myShortcut.QueryInterface(Ci.nsILocalFileWin);
var myScIcon = new FileUtils.File('C:\\Users\\Noitidart\\Downloads\\amo-puzzle.ico'); //myScIcon must be converted to ico if it isnt an ico
myShortcutWin.setShortcut(exe, null, '-P "ya ya"', 'Launches Mozilla Firefox with "ya ya" Profile', myScIcon);
https://stackoverflow.com/a/25516219/1828637
Use AppleScript here: https://ask.mozilla.org/question/1126/shortcut-created-on-mac-with-osfile-but-cant-get-around-unidentified-developer-error/