From: "Berger, Daniel" Date: 2006-09-07T02:48:04+09:00 Subject: Re: A little idiom I like > -----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 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') => # 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.