Copy XREExeF and paste it as a file shortcut

advertisements

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.


No, there is no cross-platform way to create shortcuts. In fact there is not even a cross-browser format for shortcuts, as the Wikipedia page you already referenced tells you. Instead each platform uses it's own type(s) of links:

Each of these things behaves differently. NTFS/*nix hard links are not even files, but just different names for the same file.

Also, the pinning you're describing is specific to Windows, anyway. Other desktop environments may use completely different pinning, if they even offer a comparable feature at all, or at least their pinning equivalents may have completely different semantics.