Find.find reversed order on MacOSX Snow Leopard

Discussion in 'Ruby' started by Raphaël Marmier, Oct 19, 2009.

  1. Hi all,

    I just found out that the following code yields the directory listing in
    reverse alphanumerical order on Snow Leopard (10.6.1). This is with the
    out-of-the-box ruby install.

    require 'find'
    Find.find '/Library/Preferences/' do |x| puts x end

    On MacOSX 10.5 Leopard, it yielded the listing in either default system
    order, or alphanumerical order, I don't remember.

    Is it expected behaviour and what can I do to restore the previous one?

    thanks
    Raphaël
    --
    Posted via http://www.ruby-forum.com/.
    Raphaël Marmier, Oct 19, 2009
    #1
    1. Advertising

  2. Raphaël Marmier

    Patrick Okui Guest

    On 20 Oct, 2009, at 12:19 AM, Rapha=EBl Marmier wrote:

    > Hi all,
    >
    > I just found out that the following code yields the directory =20
    > listing in
    > reverse alphanumerical order on Snow Leopard (10.6.1). This is with =20=


    > the
    > out-of-the-box ruby install.
    >
    > require 'find'
    > Find.find '/Library/Preferences/' do |x| puts x end
    >
    > On MacOSX 10.5 Leopard, it yielded the listing in either default =20
    > system
    > order, or alphanumerical order, I don't remember.


    Just tried that on 10.5 and it still gives reverse alphanumerical order.

    [pokui@mbp-pjo:~]$ sw_vers
    ProductName: Mac OS X
    ProductVersion: 10.5.8
    BuildVersion: 9L30
    [pokui@mbp-pjo:~]$ ruby -r 'find' -e 'Find.find "/Library/=20
    Preferences/" do |x| puts x end'
    /Library/Preferences/
    /Library/Preferences/SystemConfiguration
    ...
    ...
    ...
    /Library/Preferences/com.apple.AppleFileServer.plist
    /Library/Preferences/com.apple.alf.plist
    /Library/Preferences/com.apple.AirPortBaseStationAgent.launchd
    /Library/Preferences/.GlobalPreferences.plist
    [pokui@mbp-pjo:~]$=20=
    Patrick Okui, Oct 19, 2009
    #2
    1. Advertising

  3. I understand now that any sort performed on a find() would delay it
    until directory traversal is complete.

    Thanks for your answers.

    Raphaël


    Yukihiro Matsumoto wrote:
    > Hi,
    >
    > In message "Re: Find.find reversed order on MacOSX Snow Leopard"
    > on Tue, 20 Oct 2009 06:19:50 +0900, Rapha�l Marmier
    > <> writes:
    >
    > |I just found out that the following code yields the directory listing in
    > |reverse alphanumerical order on Snow Leopard (10.6.1). This is with the
    > |out-of-the-box ruby install.
    >
    > |Is it expected behaviour and what can I do to restore the previous one?
    >
    > Find.find does no sorting. It traverse through paths in the order
    > given from underlying OS. If you see the order changed on Snow
    > Leopard, it must be their _fault_. If you really need the specific
    > order, you have to gather paths first, then sort them before process.
    >
    > matz.


    --
    Posted via http://www.ruby-forum.com/.
    Raphaël Marmier, Oct 20, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alia Khouri

    python version in snow leopard?

    Alia Khouri, Jun 9, 2009, in forum: Python
    Replies:
    2
    Views:
    261
    Alia K
    Jun 9, 2009
  2. Roedy Green

    Java hom foer the Mac Snow Leopard?

    Roedy Green, Sep 2, 2009, in forum: Java
    Replies:
    7
    Views:
    374
    Kevin McMurtrie
    Sep 7, 2009
  3. Xiao Yu
    Replies:
    0
    Views:
    405
    Xiao Yu
    Oct 13, 2009
  4. Zectbumo
    Replies:
    1
    Views:
    363
  5. Xiao
    Replies:
    1
    Views:
    480
    Ned Deily
    Dec 1, 2009
Loading...

Share This Page