Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Find.find reversed order on MacOSX Snow Leopard (http://www.velocityreviews.com/forums/t860061-find-find-reversed-order-on-macosx-snow-leopard.html)

Raphaël Marmier 10-19-2009 09:19 PM

Find.find reversed order on MacOSX Snow Leopard
 
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/.


Patrick Okui 10-19-2009 09:55 PM

Re: Find.find reversed order on MacOSX Snow Leopard
 

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=


Raphaël Marmier 10-20-2009 07:39 AM

Re: Find.find reversed order on MacOSX Snow Leopard
 
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
> <raphael@marmier.net> 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/.



All times are GMT. The time now is 07:45 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


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