[Jslib] File IO

Jacob Emcken jacob at emcken.dk
Sat Jul 26 18:52:16 EDT 2003


Hi

I use the the readDir() to generate an array with all the files and dirs
in the current path.

Now I want to append a Dir object in the beginning og the array with the
parent directory i.e.

var dir = new Dir(path);
var dirList = dir.readDir();

var parentDir = dir.parent;
parentDir.leaf = "..";
dirList.unshift(parentDir);

But if I alter the leaf the path gets all fucked up :(

I'm probaly doing this the wrong way but I want to make a loop that list 
the files and dirs in a list with the parent dir first like this.

..
Documents
.mozilla
.gaim
example.txt
test.swx
etc.


The resaon why I want just to alter the leaf is to avoid having if-else 
in my loop.

Thanks
-- Jacob



More information about the Jslib mailing list