Berger, Daniel
9/6/2006 5:48:00 PM
> -----Original Message-----
> From: Austin Ziegler [mailto:halostatue@gmail.com]
> Sent: Wednesday, September 06, 2006 11:15 AM
> To: ruby-talk ML
> Subject: Re: A little idiom I like
>
>
> On 9/4/06, Hal Fulton <hal9000@hypermetrics.com> wrote:
> > Rick DeNatale wrote:
> >> No easily, even if you can figure out how to define a
> method named \
> >> or "\\" it's going to be messy sending it.
> > If we're seriously talking about a Windows usage, let me point out
> > that it's only on the command line that \ is needed.
>
> Mostly.
>
> > Internally, WIndows paths can use ordinary slashes (in
> every case I'm
> > familiar with).
>
> Mostly.
>
> The reality of the matter is that with the APIs that Ruby is
> currently using -- which are problematic for certain cases
> (Unicode) -- the \ and / are interchangeable internally.
>
> The advanced APIs -- the Unicode ones and the ones that make
> it possible to have very long path names -- requires \.
>
> -austin
Indeed. This is why all paths generated using the pathname2 package
convert all forward slashes to backslashes. Also, the various PathXXX
functions do NOT work with forward slashes.
To wit:
irb(main):001:0> require 'Win32API'
=> true
irb(main):002:0> PathIsRoot = Win32API.new('shlwapi', 'PathIsRoot', 'P',
'I')
=> #<Win32API:0x2c17be8>
irb(main):003:0> PathIsRoot.call("C:\\")
=> 1
irb(main):004:0> PathIsRoot.call("C:/")
=> 0
Regards,
Dan
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.