dirname/basename 术语起源于哪里?
dirname
和basename
分别指删除尾随组件的路径和尾随组件的术语的起源和原因是什么?- 术语是否标准化?在哪里?
- 是否有替代或等效的约定来指代以这种方式分割路径?
Update0
特别是,主要操作系统或库上使用的替代方案令人感兴趣。
- 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 interest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
术语
dirname
和basename
看起来非常简单,即“目录名称”和“目录内的基本名称”,所以我认为这些没有任何具体原因名称。我不确定你所说的“术语是否标准化”是什么意思。这些调用是 POSIX 标准的一部分(dirname,basename),但它们也被许多高级语言(如 PHP)借用(目录名, 基本名称), Perl 和 Python。
其他等效项:
在 Windows 上,shell API 提供
PathRemoveFileSpec
和PathStripPath
函数,与dirname
和basename
类似。在 Java 中, File 类提供 < code>getParent 和
getName
执行相同的操作。The terms
dirname
andbasename
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
andPathStripPath
functions, which are similar todirname
andbasename
.In Java, the File class provides
getParent
andgetName
which do the same thing.