|
Page Updated: December 22, 2005
Latest Version: 0.1.375 |
|
Debug |
Install | File
I/O |
RDF |
Network |
Sound | Utils |
XUL | Zip
|
|
|
Home | Mailing List |
Install |
Source Code |
Downloads | Bugs
| docs
| clients |
ChromeFile
Function List- Constructor
- ChromeFile(aChromePath)
- creates the ChromeFile object and sets the desired chrome url
- Accessors
- open();
- open a file handle for reading - readonly.
- close();
- closes the file handle
- exists();
- check to see if a file exists
- read();
- returns the contents of a chrome file
- File attributes
- size;
- returns the file size
- File string manipulation
- chromePath;
- returns the initialized chrome path
- urlPath;
- returns the url path eg:
resource:/chrome/jslib/jslib.xul
- localPath;
- returns the local path of the chrome url eg:
/backups/binaries/moz_1.7.12/mozilla/chrome/jslib/jslib.xul
- isJarFile
- returns true if the chrome file is inside a jar package
- Direct manipulation
- nsIFIle;
- returns an nsIFile object
- File
- returns a jslib File object
- nsIZipReader
- returns an nsIZipReader object
- ZIp
- returns a jslib Zip object
- ChromeFile utilities
- copy(aDest);
- copies current file to a destination
- Help!
- help;
- currently dumps a list of available functions
js> include(jslib_chromefile);
0
js> var cf = new ChromeFile("chrome://jslib/content/");
js> cf.chromePath;
chrome://jslib/content/
js> cf.urlPath;
resource:/chrome/jslib/jslib.xul
js> cf.localPath;
/backups/binaries/moz_1.7.12/mozilla/chrome/jslib/jslib.xul
js> cf.size;
1039
js> cf.isJarFile;
false
js> cf.exists();
true
js> cf.nsIFile;
[xpconnect wrapped nsIFile]
js> cf.File;
[object Object]
js> cf.nsIZipReader;
null
js> cf.Zip;
null
js> cf.copy("/tmp/chromeFileCopied.xul");
0
js> cf.open();
0
js> cf.read();
<?xml version="1.0"?>
<!DOCTYPE window>
<window
id="jslib-launcher"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Launch jsLib"
onload="launchSplash();">
<script type="application/x-javascript">
<![CDATA[
jslib.init(this);
include(jslib_window);
function launchSplash ()
{
if (window.arguments && window.arguments[0] != "") {
var relPath = window.arguments[0];
switch (relPath)
{
case "about":
relPath = "jslib/content/aboutDialog.xul";
break;
case "version":
jslibLaunchSplash();
return closeWin();
}
var win = new CommonWindow(JS_LIB_PATH+relPath, 350, 300);
win.position = JS_MIDDLE_CENTER;
win.open();
} else {
jslibLaunchSplash();
}
closeWin();
}
function closeWin ()
{
if (content || _content ) return;
setTimeout("close()", 1000);
}
]]>
</script>
<vbox id="appcontent" flex="100%">
<description> </description>
</vbox>
</window>
js> cf.close();
0
js> quit();