Next in Review Queue: The New std.path
Nick Sabalausky
a at a.a
Fri Jul 15 01:33:34 PDT 2011
"dsimcha" <dsimcha at yahoo.com> wrote in message
news:ivo1ef$1ero$1 at digitalmars.com...
> Lars Kyllingstad's new and improved std.path module for Phobos is the next
> item up in the review queue.
>
Yay!
First of all, very well-written docs :)
My notes:
- For clarity and completeness, the docs for joinPath should include the
example:
joinPath("foo", "bar");
It does already have joinPath(r"c:\foo", "bar"), but it's easy to overlook
the fact that's demonstrating the same thing, especially if you're more
interested in Posix.
- For generic purposes, maybe joinPath should accept being called with just
one argument? If it already does, then the "Joins two or more path
components" should change to "Joins one or more path components"
- Maybe there should be a function canonical() that resolves symbolic links,
runs absolutePath() and normalize(), and on Windows converts to lowercase.
Doesn't need to be in there right now though, could wait for a later
release.
- Docs don't say how pathCharMatch handles slash and backslash.
- I really hate to bring up a function-naming issue at this point, but
"glob" is commonly known to mean "Return all existing files/paths that match
this pattern" (And that's something we should have at some point, btw, if we
don't already). So maybe this glob should be called something like globMatch
or matchGlob instead.
- I don't think I like how glob works. It doesn't seem to know anything
about directory separators, which seems unintuitive and problematic. I'd
really like to see it work like this (basically from Ruby):
assert( glob("dir/foo", "dir/*") );
assert( glob("dir/foo", "dir/**") );
assert( !glob("dir/foo/bar", "dir/*") );
assert( glob("dir/foo/bar", "dir/**") );
assert( glob("dir/foo/abc", "dir/*/abc") );
assert( glob("dir/foo/abc", "dir/**/abc") );
assert( !glob("dir/foo/bar/abc", "dir/*/abc") );
assert( glob("dir/foo/bar/abc", "dir/**/abc") );
assert( glob("dir/foo", "dir/f*o") );
assert( !glob("dir/faa/boo", "dir/f*o") );
As it is right now, how would you do a non-recursive star-match? Doesn't
look like you even can.
More information about the Digitalmars-d
mailing list