Quantcast
Viewing all articles
Browse latest Browse all 100

Ruby master - Misc #16396: What is the reason for this behaviour of Find.find?

I can not say whether this is the case or not (I work only on Linux), also due to me
using Dir[] preferentially instead. With Dir[] I always make sure to have a trailing
'/' token if I wish to work with directories, and subdirectories, respectively, e.g:

pp Dir['/tmp/**/**/']

Based on that I tend to then use .select or .reject, such as when I wish to find
only certain files. There is also Dir.glob() but I sort of transitioned into Dir[]
completely - it just seems so much simpler to me than all alternatives.

Back to your comment - it may be best to compare the results that you have found
with Find.find(), to Dir[], and look whether there are any alternatives that may
be a bug. If it is a bug, it could help the ruby core team if you could reproduce
it into a small use case that they can test (I think most ruby core team members
use linux or mac, although perhaps some also have windows or some dual-boot setup.)

The easier it can be made for the core team to test, the better if the goal is to
resolve problems (if they are really problems that is).

On a side note - I have found that my ruby code works fine on windows too even if
I just use "/" in file paths. The reason I adopted trailing / a long time ago is
because it made it simpler to me, understanding what is going on. Perhaps your
description may also be an example where trailing / are bettr to use, as in them
being more explicit - even if there should not be a difference (I really can't
say, I don't use or seem to need Find.find() really).


Viewing all articles
Browse latest Browse all 100

Trending Articles