문제

Assume we have a XULRunner application installed at C:\myapp\, that is, application.ini file etc. are in that directory. My question is: how to get the installation path (C:\myapp\) in the app's JavaScript code?

도움이 되었습니까?

해결책

I think that for XULrunner, CurProcD is usually the installation path:

var path = Components.classes["@mozilla.org/file/directory_service;1"]
             .getService(Components.interfaces.nsIProperties)
             .get("CurProcD", Components.interfaces.nsIFile).path;

Failing that, you might also try resource:app.

Ref: File I/O at MDN.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top