std.path review: second update

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Sat Jul 30 01:17:01 PDT 2011


On Fri, 29 Jul 2011 21:10:30 +0200, Johannes Pfau wrote:

> Lars T. Kyllingstad wrote:
>>Here's a new update based on your comments and requests.  Code and docs
>>are in the usual place,
>>
>>  https://github.com/kyllingstad/phobos/blob/std-path/std/path.d
>>  http://www.kyllingen.net/code/std-path/phobos-prerelease/std_path.html
>>
>>Here are the highlights:
>>
>>* UNC paths, i.e. \\server\share\..., are now (hopefully) handled
>>correctly on Windows.  See the baseName(), dirName(), rootName(),
>>driveName(), pathSplitter(), etc. docs for examples.
>>
>>* Support for //foo/bar paths on POSIX has been removed.
>>
>>* rootName() is new.
>>
>>* pathSplitter() now returns a bidirectional range.
>>
>>* pathCharMatch() and fcmp() have been replaced by improved functions
>>filenameCharCmp() and filenameCmp(), respectively, with optional case
>>sensitivity.
>>
>>* joinPath() has been renamed to buildPath().
>>
>>* Added a function buildNormalizedPath(), which performs normalization
>>while joining the segments.
>>
>>* Redefined normalize() in terms of buildNormalizedPath().
>>
>>I am still unsure of the extent to which long UNC paths (i.e. \\?\...)
>>should be supported, if at all.  If anyone has anything to say on the
>>matter, please do. :)
>>
>>-Lars
> 
> As globMatch's "individual character comparisons are done calling
> filenameCharCmp()" and filenameCharCmp has case-sensitive and
> case-insensitive versions, could we also get this behavior for
> globMatch?

Sure.  That was my intention all along, but I forgot.  I'll fix it as 
soon as possible.


> I even have a use case for this ;-)
> The FreeDesktop MIME database uses it:
> http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-
spec-latest.html
> 
> "Applications MUST match globs case-insensitively, except when the
> case-sensitive attribute is set to true. This is so that e.g. main.C
> will be seen as a C++ file, but IMAGE.GIF will still use the *.gif
> pattern."

:)

-Lars


More information about the Digitalmars-d mailing list