If path
is an empty string, then both dirname2()
and
basename2()
return an emty string.
\
and /
are accepted as path separators, and dirname2()
does NOT translate the path separators.
Recall that a network share looks like "//host/share"
and a drive looks
like "d:"
.
For a path which starts with a network share or drive, the path specification
is the portion of the string immediately afterward, e.g. "/path/to/file"
is the path specification of "//host/share/path/to/file"
and
"d:/path/to/file"
. For a path which does not start with a network share
or drive, the path specification is the entire string.
And lastly, the path specification of a network share will always be empty or
absolute, but the path specification of a drive does not have to be, e.g.
"d:file"
is a valid path despite the fact that the path specification
does not begin with "/"
.
If the path specification of path
is empty or is "/"
, then
dirname2()
will return path
and basename2()
will return an
empty string.