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!
Thanks!
> 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.
<snip>
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.
Ok.
> 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
time.
Thanks for the report.
Regards,
Dan