Re: FileTest.size > 2GB?

Daniel B. wrote:

Yes, use win32-file, available on the RAA.

Daniel, you are the hero of Ruby users on Windows.


Heh, thanks. :slight_smile:

The long version of this is that win32-file uses GetFileSizeEx() behind
the scenes to get the file size instead of using the ‘size’ member of
the File::Stat structure. I suppose I should mention that it will only
work properly on Windows 2000 and later. Hopefully no one is still
using Windows NT any more. It could be fixed by using __int64 behind
the scenes iirc but I haven’t looked at it in a while.

One of the things on the TODO list is to redefine the File::Stat
structure on Windows completely (and submit a patch) because there are
several other members that should be added (e.g. stuff you can get via
the GetFileAttributes() function) and a few current ones that need
fixing, e.g. ‘chardev?’. I’ve been lazy about it, in part because of
the custom definitions of the Comparable methods such as ‘==’, which is
a lot of annoying grunt work to implement. This might be easier,
however, now that I’ve more or less decided to ditch C extensions in
favor of pure Ruby Win32API packages for most (though not all) of the
win32utils packages.

In fact, win32-file is the package I plan on reworking into pure Ruby
form next. :slight_smile:



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs