Re: documentation patch for Dir::glob
"Tim Harper" <[email protected]> Thu, 2 Aug 2007 20:56:29 -0600
| Newsgroups | gmane.comp.lang.ruby.documentation |
|---|---|
| Message-ID | <004001c7d579$e483a3e0$ad8aeba0$@com> |
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:[email protected]] Sent: Thursday, August 02, 2007 8:55 PM To: [email protected] Subject: Re: documentation patch for Dir::glob On 02/08/07, Tim Harper <[email protected]> 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.