Note that there are some explanatory texts on larger screens.

plurals
  1. POxul: open a local html file relative to "myapp.xul" in xul browser
    primarykey
    data
    text
    <p>in short: <strong>is there any way to find the current directory full path of a xul application?</strong></p> <p>long explanation:</p> <p>I would like to open some html files in a xul browser application. The path to the html files should be set programmatically from the xul application. The html files reside outside the folder of my xul application, but at the same level. (users will checkout both folders from SVN, no installation available for the xul app)</p> <p>It opened the files just fine if I set a full path like "file:///c:\temp\processing-sample\index.html"</p> <p>what i want to do is to open the file relative to my xul application. </p> <p>I found i can open the user's profile path:</p> <pre><code>var DIR_SERVICE = new Components.Constructor("@mozilla.org/file/directory_service;1", "nsIProperties"); var path = (new DIR_SERVICE()).get("UChrm", Components.interfaces.nsIFile).path; var appletPath; // find directory separator type if (path.search(/\\/) != -1) { appletPath = path + "\\myApp\\content\\applet.html" } else { appletPath = path + "/myApp/content/applet.html" } // Cargar el applet en el iframe var appletFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); appletFile.initWithPath(appletPath); var appletURL = Components.classes["@mozilla.org/network/protocol;1?name=file"].createInstance(Components.interfaces.nsIFileProtocolHandler).getURLSpecFromFile(appletFile); var appletFrame = document.getElementById("appletFrame"); appletFrame.setAttribute("src", appletURL); </code></pre> <p><strong>is there any way to find the current directory full path of a xul application?</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload