Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Find.find reversed order on MacOSX Snow Leopard

Reply
Thread Tools

Find.find reversed order on MacOSX Snow Leopard

 
 
Raphaël Marmier
Guest
Posts: n/a
 
      10-19-2009
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/.

 
Reply With Quote
 
 
 
 
Patrick Okui
Guest
Posts: n/a
 
      10-19-2009

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=

 
Reply With Quote
 
 
 
 
Raphaël Marmier
Guest
Posts: n/a
 
      10-20-2009
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/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Snow, glorious snow.....brings down the global warming fanatics richard Computer Support 10 02-07-2010 01:02 AM
Java hom foer the Mac Snow Leopard? Roedy Green Java 7 09-07-2009 08:00 PM
python version in snow leopard? Alia Khouri Python 2 06-09-2009 08:47 AM
python 64bits on macosx.5 /leopard Mathieu Prevot Python 1 08-14-2008 11:42 AM
SNOW LEOPARD REACTS TO FOVEON IMAGE! JPS@no.komm Digital Photography 6 02-13-2004 08:51 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57