Next in Review Queue: The New std.path
Nick Sabalausky
a at a.a
Fri Jul 15 12:21:49 PDT 2011
"Lars T. Kyllingstad" <public at kyllingen.NOSPAMnet> wrote in message
news:ivpl34$gf5$3 at digitalmars.com...
> On Fri, 15 Jul 2011 02:45:02 +0200, Andrej Mitrovic wrote:
>
>> All functions have nice names except fcmp, why the abbreviation?
>
> For consistency with std.algorithm.cmp and std.string.icmp, on which it
> is based. I'd be open for other suggestions if people think it should be
> changed.
>
I'm happy with it having the obscure name "fcmp" because *all* it is is
either a case-insensitive or case-sensitive string comparison, and I think
it's dangerous to blindly use that to compare filepaths. If it were named
something like "filePathCompare", then people would get a nastly surprise
when this returned false instead of true:
filePathCompare(r"C:\dir\file.txt", r"C:\dir/foo\..\file.txt");
I can't imagine getting false from that would ever be desirable.
This is a big part of why I think we need a canonical() function (although
maybe a more like "canonicalPath" for the same reason that we have
"joinPath" instead of "join").
>
>> Is expandTilde supposed to work on Windows? I've never seen tilde used
>> there.
>
> Nope, as specified in the docs it is a no-op on Windows. As Nick points
> out, it is not obvious what is the correct "home directory" on Windows.
> Moreover, and perhaps even more importantly, there is no precedence for
> the tilde character to mean "home directory" on Windows at all.
>
Actually, if Windows did have one single equivalent to "/home/{user}", then
I think it would be absolutely fantastic to make tilde mean "home directory"
on Windows. But as things are, that's a moot point, of course.
More information about the Digitalmars-d
mailing list