[Jslib] Dir.readDir()

Greg Marine gregmarine at gmail.com
Mon Jan 15 13:40:06 PST 2007


Thank you thank you thank you!!! Pete, this gives me what I need. Please do
let me know when you put it in your code. That way I can use the readDir()
method instead of this work around. Thank you for maintaining jslib. Just so
you know, I'm using it in a xulrunner application.

Thanks again!
Greg

On 1/15/07, Pete Collins <pete at mozdevgroup.com> wrote:
>
> Yea, try this:
>
> var a = new Array;
>
> for (var i=0;i<entries.length; i++) a.push(entries[i].path);
>
> // sorted entries
> var s = a.sort();
>
> // print the sorted entries
> for (i=0;i<s.length;i++) jslibPrint(s[i]);
>
> Having readDir() sort them is something I will need to add ...
>
>
> --pete
>
>
> Greg Marine wrote:
>
> > Pete,
> >
> > Thank you for your response. However, the issue I am having is in the
> > sort order of the files and directories on my Linux box. In Windows,
> > the sort is alphabetical. But in Linux, there doesn't appear to be any
> > rhyme or reason to the order in which the files and directories are
> > returned by readDir(). I want to have it sorted alphabetically.
> >
> > Thanks,
> > Greg
> >
> > On 1/14/07, *Pete Collins* <pete at mozdevgroup.com
> > <mailto:pete at mozdevgroup.com>> wrote:
> >
> >
> >
> >     Greg Marine wrote:
> >
> >     > Hello,
> >     >
> >     > I'm having a sorting issue with the readDir() method of the Dir
> >     > module. On WinXP, the files/folders are in alphabetical order.
> >     > However, in Linux it won't sort alphabetically. I even attempted
> to
> >     > using the sort() method for JavaScript arrays and it still
> >     didn't sort
> >     > correctly. Is this a bug?
> >     >
> >     > I appreciate your help!
> >     >
> >
> >     The platform shouldn't matter since readDir returns a js array of
> the
> >     entries ...
> >
> >     The entries are js File objects.
> >
> >     var e = d.readDir();
> >
> >     jslibPrint(e[0].path);
> >
> >       /tmp/foo
> >
> >     Hope this helps ...
> >
> >     --pete
> >
> >     --
> >     Pete Collins - Founder, Mozdev Group Inc.
> >     www.mozdevgroup.com <http://www.mozdevgroup.com>
> >     Mozilla Software Development Solutions
> >     tel: 1-719-302-5811
> >     fax: 1-719-302-5813
> >
> >     _______________________________________________
> >     Jslib mailing list
> >     Jslib at mozdev.org <mailto:Jslib at mozdev.org>
> >     http://mozdev.org/mailman/listinfo/jslib
> >
> >
> >
> >
> > --
> > Internet Community Church Ministries
> > http://www.iccnet.org
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >Jslib mailing list
> >Jslib at mozdev.org
> >http://mozdev.org/mailman/listinfo/jslib
> >
> >
>
> --
> Pete Collins - Founder, Mozdev Group Inc.
> www.mozdevgroup.com
> Mozilla Software Development Solutions
> tel: 1-719-302-5811
> fax: 1-719-302-5813
>
> _______________________________________________
> Jslib mailing list
> Jslib at mozdev.org
> http://mozdev.org/mailman/listinfo/jslib
>



-- 
Internet Community Church Ministries
http://www.iccnet.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/jslib/attachments/20070115/06f8fc1b/attachment.html 


More information about the Jslib mailing list