[Jslib] Reading a file out of a JAR

James A.Overton james at overton.ca
Tue Mar 30 23:24:35 EST 2004

	I googled high and low for an answer, but couldn't find one. So I'll 
go straight to the source.
	I want to read (not write) a file which is contained in a JAR inside 
the chrome directory. I'm using the very latest jslib Production XPI 
(Firefox 0.8 on MacOS X 10.3.3). Here's the code:
		include ('chrome://jslib/content/io/file.js');
		include ('chrome://jslib/content/io/fileUtils.js');
		var fu = new FileUtils( );
		var path = fu.chromeToPath("chrome://mozile/content/saving/rsd.xml");
		var f = new File(path);
		var read = f.read();
	The path variable returns fine, as 
"/whatever/chrome/mozile.jar!/content/saving/rsd.xml". And f.open('r') 
and f.read() don't crash anything, but "read" is empty, length=0.
	Since this code works fine for normal files, I figure it's a JAR 
thing. Can jslib read inside my mozile.jar file?


More information about the Jslib mailing list