本文介绍了复制XREExeF并粘贴为文件快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的插件中,我是通过以下方式启动Firefox配置文件的:

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

因此,这将添加命令行参数并启动它.但是,这导致一些问题.用户想要固定图标,而只是固定另一个firefox.exe.用户还尝试更改图标.

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.

维基百科说所有操作系统都支持快捷方式: http://en.wikipedia.org/wiki/File_shortcut

Wikipedia says all OS support shortcuts: http://en.wikipedia.org/wiki/File_shortcut

所以我想复制XREExeF并将其粘贴为快捷方式,然后向其中添加命令行参数.

So I wanted to copy XREExeF and paste it as a shortcut and then add command line arguments to it.

感谢@nmaier,我现在知道没有跨操作系统的方法.您能告诉我具体的方法吗?

Thanks to @nmaier I now know there is no cross-os method. Can you please show me os specific methods.

推荐答案

Windows

在此示例中,创建的快捷方式将被称为"Mozilla Firef ya",并将打开一个名为"ya ya"的配置文件.

Windows

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

08-31 08:37