Hi, this threat started on the old forum:
>I just want to ask wether the following is possible (I want it work locally or as XUL-Extension):
>The Goal is to display the directory tree, including fies with specific extension in a HTML document.
>I wrote a Perl program to create such a document,
>but now I want a document that creates itself using DOM, only problem is that Javascript has no commands like "dir"
> or "ls" or whatever. But I think Mozilla should have made this possible, e.g. for extension at least.
> > It would need to be an extension. You can use nsIFile and the .directoryEntries attribute on that.
Can you please give a short example? I never used XPCom objects and don't know how to create/access them.
E.g. how do I get the first entry of path "L:\"?
Ciao/2 Christoph
Access Directory structure from Javascript
-
- Posts: 26
- Joined: November 5th, 2002, 4:37 am
- andyed
- Posts: 78
- Joined: November 5th, 2002, 6:31 am
- Location: Clemson, SC
- Contact:
JSLib does the Filesystem
Try http://jslib.mozdev.org.
It provides a javascript API on top of the XPCOM file system code. You should find it easy.
It provides a javascript API on top of the XPCOM file system code. You should find it easy.
>>> http://surfmind.com/ <<<
-
- Posts: 26
- Joined: November 5th, 2002, 4:37 am
XPCOM
thanx for the tip, although the lik doesn't work properly I found jslib and I will try it.
Additionally do I like to learn new things, so I would like if someone could give me a start boost example.
Thanx in advance!
Ciao/2 Christoph
Additionally do I like to learn new things, so I would like if someone could give me a start boost example.
Thanx in advance!
Ciao/2 Christoph
Last edited by Birdy27 on November 5th, 2002, 10:05 am, edited 1 time in total.
-
- Posts: 1634
- Joined: November 4th, 2002, 8:34 pm
- Location: Kyoto, Nippon (GMT +9)
- Contact:
LocalFile
You can get nice examples at Xul Planet com.
The article about nsILocalFile is here. http://www.xulplanet.com/tutorials/xultu/xpcom.html
I'm wating for jslib update.
That's grate if we can create a zip file with the library.
The article about nsILocalFile is here. http://www.xulplanet.com/tutorials/xultu/xpcom.html
I'm wating for jslib update.
That's grate if we can create a zip file with the library.
Thank you.
-
- Posts: 26
- Joined: November 5th, 2002, 4:37 am
Permission denied
thanx I went though the introduction, but failed as I get
"Error: uncaught exception: Permission denied to get property UnnamedClass.classes"
I tried to call "Components.classes["@mozilla.org/file/local;1"].createInstance();" from JavaScript from within a normal local HTML file. Is there anything wrong with that?
Ciao/2 Christoph
"Error: uncaught exception: Permission denied to get property UnnamedClass.classes"
I tried to call "Components.classes["@mozilla.org/file/local;1"].createInstance();" from JavaScript from within a normal local HTML file. Is there anything wrong with that?
Ciao/2 Christoph
- bzbarsky
- Posts: 478
- Joined: November 5th, 2002, 1:36 pm
Where you can use XPCOM from
You can use XPCOM from chrome. Local files are still not trustworthy enough for XPCOM access (as stated, such access would allow doing things like deleting files, reading security-critical information, etc, etc). So your file has to be installed as part of the browser (there are tutorials out there on how to do this....)
-
- Posts: 935
- Joined: November 4th, 2002, 4:50 pm
http://xulplanet.com/tutorials/xultu/
books.mozdev.org
books.mozdev.org