dirname/basename 术语起源于哪里?

发布于 2024-09-19 21:33:25 字数 205 浏览 4 评论 0原文

  1. dirnamebasename 分别指删除尾随组件的路径和尾随组件的术语的起源和原因是什么?
  2. 术语是否标准化?在哪里?
  3. 是否有替代或等效的约定来指代以这种方式分割路径?

Update0

特别是,主要操作系统或库上使用的替代方案令人感兴趣。

  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 interest.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半﹌身腐败 2024-09-26 21:33:25

术语 dirnamebasename 看起来非常简单,即“目录名称”和“目录内的基本名称”,所以我认为这些没有任何具体原因名称。

我不确定你所说的“术语是否标准化”是什么意思。这些调用是 POSIX 标准的一部分(dirnamebasename),但它们也被许多高级语言(如 PHP)借用(目录名, 基本名称), PerlPython

其他等效项:

在 Windows 上,shell API 提供 PathRemoveFileSpecPathStripPath 函数,与 dirnamebasename 类似。

在 Java 中, File 类提供 < code>getParent 和 getName 执行相同的操作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文