开发者

Where does the dirname/basename terminology originate?

开发者 https://www.devze.com 2023-01-16 15:50 出处:网络
What are the origins and reasons for the terms, dirname and basename, referring to the path with the trailing component removed, and the trailing component respectively?
  1. What are the origins and reasons for the terms, dirname and basename, referring to the path with the trailing component removed, and the trailing component respectively?
  2. Is the terminology standardized, and where?
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消