[Win32utils-devel] win32-dir broken (and windows-pr's limits.rb issues warnings) in ruby 1.9

Daniel Berger djberg96 at gmail.com
Wed Feb 3 20:22:32 EST 2010

On Tue, Feb 2, 2010 at 12:39 PM, Kendall Gifford <zettabyte at gmail.com> wrote:
> Hi everyone, I'm pretty new to the win32-utils project: looks pretty cool!


> Anyhow, for my development I'm using ruby 1.9.1 (p243) on Windows XP
> Pro, SP3 (I download the ruby installer project's zip and development
> kit).
> I installed the win32-dir gem (which pulled in windows-pr too) and I'm
> trying to use a few of the constants it adds to the Dir class.
> However, on my first try on a very simple program, I got and error.


Thanks, I'll look into it and try to get a fix out soon.

> However, the $KCODE warning from above isn't as simple for me. I see
> what the problem is, windows-pr gem's limits.rb file (line 17 on gem
> version 1.0.8) uses $KCODE in a condition. The idea is to have a
> larger value set for MAXPATH if using 'UTF8' encoding, otherwise set
> MAXPATH to 256. Since $KCODE isn't used in 1.9 it is (I'm guessing)
> nil (at least in my case) so it will always issue the warning and set
> MAXPATH to 256.
> Now, my simple code will likely still work but I'd like to resolve the
> warning (I'm OCD) and have it work the "right" way for 1.8 <---> 1.9
> compatibility. So, I guess this is a "feature request" as it were.


> So, is Window's MAXPATH constant based on whether you use the ANSI vs.
> their UNICODE version of an API call generally or is it more
> complicated than that? Do win32-utils delegate to the ANSI ("A") or
> UNICODE ("W") version of an API call based on the $KCODE value
> globally? I'll dig into some code and try to answer my own question
> but, if someone just knows this stuff well off the top of their head,
> I'd appreciate the help. I've done a fair amount of C-based Win32
> coding in the past and would like to help with these various projects
> (to do my part); especially to get everything working smoothly on 1.9.
> Anyhow, thanks everyone for your hard work making these gems!

It used to be that the wide character function would be used if $KCODE
was set, but it caused too much confusion in practice. By default, it
will use the ansi version.

The MAXPATH value currently does look at $KCODE. Obviously, this will
not work for 1.9. I'll have to check encoding or something. I don't
use 1.9 in practice, so that's why these errors creep up from time to

Thanks for the report.



More information about the win32utils-devel mailing list