Nobuyoshi Nakada wrote: > Hi, > > At Wed, 16 May 2007 16:38:36 +0900, > Daniel Berger wrote in [ruby-core:11181]: >> 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. > > They are not equivalent Without a suffix it looks equivalent to me. Why do you think they aren't equivalent? , and the example PathStripPath() in > MSDN[1] seems like that the function just leaves the input > unchanged if it is not in expected form. > > [1] http://msdn2.microsoft.com/en-us/library/ms628624.aspx That's the current File.basename behavior, isn't it? File.basename("Not a Path") # => "Not a Path" >> To detect if a path is a root path use PathIsRoot(). This will return >> true for "C:\\" or "\\server\\share" or even just "\\server". > > Doesn't it mean they are not basenames? We have to decide whether or not the basename of a root path is itself as a rule. BTW, back in ruby-core: 5765 Austin also mentioned handling "\\.\" and "\\?\". I'm not sure if that topic has been revisited since then. Regards, Dan