Download Firefox: WindowsMac OS X
logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: documentation patch for Dir::glob: msg#00004

Subject: Re: documentation patch for Dir::glob
That's very interesting.

On both Windows and Linux, I get the results sorted by hierarchy, then 
alphabetically every time.  On Darwin, I get the results sorted alphabetically, 
hierarchy ignored.  What OS are you on?

Tim

-----Original Message-----
From: Konrad Meyer [mailto:konrad.meyer@xxxxxxxxx] 
Sent: Thursday, August 02, 2007 8:55 PM
To: ruby-doc@xxxxxxxxxxxxx
Subject: Re: documentation patch for Dir::glob

On 02/08/07, Tim Harper <timcharper@xxxxxxxxx> wrote:
> I was surprised earlier to find out that Dir::glob returns recursive results
> in a different order given different operating systems.  For example:
> Consider the following directory structure:
>
> dir/file1.txt
>
> dir/file2.txt
>
> a_file.txt
>
> file1.txt
>
> file2.txt
>
...

I'm pretty sure the order of Dir::glob can't be counted on, and you
should sort however you need to. The current documentation mentions
nothing about the order being in any sort of dependable order. My
findings are that in a directory of 001, 002, 003, ..., 009, the array
returned by Dir::glob is not sorted at all.





<Prev in Thread] Current Thread [Next in Thread>