Daniel Berger
12/21/2006 1:53:00 AM
lrlebron@gmail.com wrote:
> I have a small snippet of code to recurse a directory which works as it
> should
>
> require 'find'
>
> Find::find('C:\test') do |f|
> p f
> end
>
> When I change it like this
>
> require 'win32/file/stat'
> require 'find'
>
> Find::find('C:\test') do |f|
> p f
> end
>
> Only the 'C:\test' directory is printed. None of the files or
> subdirectories show up.
>
> Any ideas on how to fix this?
Don't require 'win32/file/stat' directly. Require win32-file instead,
which will, in turn, require win32-file-stat.
The reason is that the 'find' module is calling File.lstat internally,
which is just a pass through method to File::Stat. For it to work
properly you need to use the File.lstat method that I've defined in the
win32-file package.
I've updated the README file for win32-file-stat to explain the
situation in a little more detail (and added a warning that you should
never require win32-file-stat directly).
Regards,
Dan