[#11073] segfault printing instruction sequence for iterator — <noreply@...>

Bugs item #10527, was opened at 2007-05-02 14:42

14 messages 2007/05/02
[#11142] Re: [ ruby-Bugs-10527 ] segfault printing instruction sequence for iterator — Nobuyoshi Nakada <nobu@...> 2007/05/10

Hi,

[#11188] Re: [ ruby-Bugs-10527 ] segfault printing instruction sequence for iterator — Paul Brannan <pbrannan@...> 2007/05/16

On Thu, May 10, 2007 at 04:51:18PM +0900, Nobuyoshi Nakada wrote:

[#11234] Planning to release 1.8.6 errata — Urabe Shyouhei <shyouhei@...>

Hi all.

17 messages 2007/05/25

Re: [ ruby-Bugs-8676 ] File.basename fails on Windows root paths

From: Daniel Berger <djberg96@...>
Date: 2007-05-16 07:38:36 UTC
List: ruby-core #11181
Nikolai Weibull wrote:
> On 5/12/07, Austin Ziegler <halostatue@gmail.com> wrote:
>> On 5/12/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
>> > At Fri, 16 Feb 2007 02:09:08 +0900,
>> > Daniel Berger wrote in [ruby-core:10321]:
>> > > The File.basename method does not work properly on Windows
>> > > root paths. IMO, calling File.basename on a root path should
>> > > return itself. However, on MS Windows it appears to be
>> > > dropping the volume name and it doesn't handle UNC root paths
>> > > correctly:
>> > Drive letter is part of base name?  It feels very strange to me.
>>
>> It's right, though.
>>
>> File.basename("C:/") should return "C:/"
>> File.dirname("C:/") should return "C:/"
>> File.basename("//server/share/") must return "//server/share/"
>> File.dirname("//server/share/") must return "//server/share/"
> 
> Not according to Microsoft's Scripting.FileSystemObject:
> 
>  Fs.GetBaseName("C:/") = ""
>  Fs.GetParentFolderName("C:/") = ""
>  Fs.GetBaseName("//server/share/") = ""
>  Fs.GetParentFolderName("//server/share/") = ""

Try it with backslashes. I don't think we want an empty string. :)

In any case, the equivalent of File.basename is PathStripPath(), though 
you'll need to mix it with PathRemoveExtension() if there's an extension 
provided. The equivalent of File.dirname is PathRemoveFileSpec(). Note 
that you'll need to use backslashes for those functions to work.

To detect if a path is a root path use PathIsRoot(). This will return 
true for "C:\\" or "\\server\\share" or even just "\\server".

Regards,

Dan



In This Thread