Bug or design? File>>for:inAndBelow:do:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Bug or design? File>>for:inAndBelow:do:

Louis Sumberg-2
I've been using File class>>for:inAndBelow:do: for awhile and just noted
something that doesn't seem right.  I use the method to build a list
containing all files in and below a given directory, but if there's a
subdirectory with the same name as the parent, the subdirectory is skipped.
There's a test in the method, "dirName = thisDir ifFalse: [..." which is the
culprit, but I don't see why it's there at all, hence the question, bug or
design?.  I changed the method body to

self for: (self composePath: dir subPath: fileSpec) do: [:fs | operation
value: dir value: fs].
self forDirectoriesIn: dir do: [:d |
    self for: fileSpec inAndBelow: (self composePath: dir subPath: d
fileName) do: operation]

and it all works fine now.  (For me at least.)

-- Louis