如何为XUL打开网络文件夹?对于我的Firefox工具栏,它可以访问C:
之类的驱动器,而不是//Development
等网络路径...代码为:file.initWithPath("\\DEVELOPMENT2");
完整代码:
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("\\\DEVELOPMENT2"); //---> this is not working
//file.initWithPath("Y:"); ---> this is working
file.reveal();
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(file);
var args = [];
process.run(false, args, args.length);
//end
答案 0 :(得分:1)
我可以看到两个问题:
"\\\\DEVELOPMENT2"
而不是"\\\DEVELOPMENT2"
。var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("\\\\DEVELOPMENT2\\folder");
file.reveal();