--- Comment #7 from Jonathan M Davis <jmdavisp...@gmx.com> 2011-11-27 20:56:35
My point was that the lack of a directory separator on the end says _nothing_
about whether a path refers to a directory or a file. I can do both
/home/jmdavis and /home/jmdavis/ and _both_ refer to a directory on my system.
And as for across OSes, I can legally put a backslash in a filename on Linux.
It would be very wrong to say that there was anything invalid about having one
at the end of a file name except on Windows. path.endsWith(dirSeparator) tells
you exactly whether the file name ends with a directory separator or not. If
you want to check that a path is valid and does not end with a directory
separator, then do
assert(isValidPath(path) && !path.endsWith(dirSeparator));
I don't see why a new function is needed for this, _especially_ when it's
perfectly legal to refer to directories _without_ a directory separator on the
end of the path. isValidPath _already_ makes sure that an incorrect directory
separator isn't used.
I don't see how you can really be using paths alone to try and determine
whether a path refers to a file or not when the path doesn't give you enough
information to do that. It would make no sense for std.path to try and
determine that IMHO precisely because the information isn't there. You need to
actually check the disk for that - which is what std.file.isFile is for.
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------