Where does the dirname/basename terminology originate?
- What are the origins and reasons for the terms,
dirname
andbasename
, referring to the path with the trailing component removed, and the trailing component respectively? - Is the terminology standardized, and where?
- Are there alternative or equivalent conventions in use to refer to the splitting of a path in this way?
Update0
In particular, alternatives used on major operating systems or libraries are of开发者_C百科 interest.
The terms dirname
and basename
seem quite straightforward, i.e. "directory name" and "base name within the directory", so I don't think there is any specific reason for these names.
I'm not sure what you mean by "Is the terminology standardized". The calls are part of the POSIX standard (dirname, basename) but they've also been borrowed by many high-level languages like PHP (dirname, basename), Perl and Python.
Other equivalents:
On Windows, the shell API provides the PathRemoveFileSpec
and PathStripPath
functions, which are similar to dirname
and basename
.
In Java, the File class provides getParent
and getName
which do the same thing.
精彩评论