A jar file is a zip file so you might try using nsIZipReader. Something
like:
var zip = Components.classes["@mozilla.org/libjar/zip-reader;1"]
.createInstance(Components.interfaces.nsIZipReader);
zip.init(the jar file goes here);
zip.open();
var entry = zip.findEntry("the file you want");
if (entry != null) OK!
zip.close();
Untested but probably worth a shot.
Andy
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Viner, David
Sent: Thursday, October 07, 2004 1:52 PM
To: '[EMAIL PROTECTED]'
Subject: checking file existance inside a jar
Hi,
I'm trying to write an extension that needs to check for the existence of a
file inside a jar file which is in the chrome directory. I've been hacking
at the problem, and I can't seem to get it to work. I start with a string
like:
chrome://yahootoolbar/icons/myicon.gif
I can resolve this to a string representing the jar file on disk, such as:
jar:file:///C:/Documents and
Settings/blah/blah/yahootoolbar.jar!contents/icons/myicon.gif
But, I can't seem to figure out how to test for the existance of this
file...
I tried turning into a nsIFile, and invoking exists(), but that didn't seem
to work.
Any thoughts?
Thanks
Dave
p.s. - if this is the wrong place to ask this question, please let me know
where I should ask it... it seems (to me) more like an XPCOM question than
anything else.
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom