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?
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 M. 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 [email protected] 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.
In message “Re: Find.find reversed order on MacOSX Snow Leopard”
on Tue, 20 Oct 2009 06:19:50 +0900, Raphaël Marmier [email protected] 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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.