Siep Korteling wrote:
> Marnen Laibow-Koser wrote:
>> bwv549 wrote:
>>> What is the best idiom for generating a cross-platform basename?
> (...)
>>> This works on windows and linux, at least the versions I'm running.
>> 
>> No it doesn't.  The problem is that there is no easy way to tell what OS 
>> a pathname came from, and each OS's directory separator is a valid 
>> filename character on the other OS.  So you could have a Windows file 
>> called c:\documents\usr/bin/ruby , where usr/bin/ruby is the actual 
>> correct basename.  Your method would fail in this case.(...)
>> 
> 
> No,  a / is not a valid filename character. None of these characters are 
> allowed : ><:"/\|?* 
> (http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#file_and_directory_names 
> )
> If you try it anyway you'll get an error. So OP's solution could work.

Thanks for the correction.  However, \ *is* a valid filename character 
on *nix, so the problem still exists.

> 
> hth,
> 
> Siep

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen / marnen.org
-- 
Posted via http://www.ruby-forum.com/.