当我操作路径和文件名时,我总是陷入困境,因为我没有一个通用的命名系统。
我需要拿出一个命名标准,并坚持它,我想要清楚和一致的其他人,所以我是开放的学习规范的答案。
考虑一下这个玩具问题:(Windows示例,但希望答案应该是独立于平台的)
已经获得了文件夹的全名:C:\USERS\OddThinking\Documents\MySource。希望遍历下面的文件夹,并将所有.src编译到.obj。
在某个时候,将看到以下字符串。
C:\users\OddThinking\Documents\My Source\Widget\foo.src
那么,将为这些部件使用什么标识符名称?
A) foo
B) foo.src
C) src
D) .src
E) C:\users\OddThinking\Documents\My Source\ - i.e. the top of the tree.
F) Widget\foo.src - i.e. the path from the top of the tree to the leaf.
G) Widget - i.e. one node of the tree.
H) C:\users\OddThinking\Documents\My Source\Widget\ - i.e. the name of the folder
I) C:\users\OddThinking\Documents\My Source\Widget\foo.src
让我给你一些答案,让你开始。
(A)基本名称?
(B)档案名称?还是文件名?在选择标识符名称时,区别是很重要的,而且我在这里从来不一致。
(C)延期
d)延期。这就是我所说的C。我应该避免存储点,然后在需要的时候放进去吗?如果特定文件上没有点怎么办?
h)路径名称?还是等一下,这只是一条路?
(I)文件名。等等,这就是我所说的C.PATH。等等,这就是我所称的H.也许H应该是文件夹的名字。不过,“文件夹”不是Windows特有的术语吗?
发布于 2018-03-23 10:46:24
我认为你对“标准”命名规则的追求是徒劳的。以下是我根据现有的知名项目提出的建议:
(A)C:\User\Oddking\Document\MySource\Widget**Foo**.src
维姆称之为文件根(帮助文件名-修饰符)
(B)C:\User\Oddking\Document\MySource\Widget**foo.src**
文件名或基名
C)C:\user\OddThinking\Documents\MySource\Widget\foo.SRC(无点)
文件/扩展名
(D)C:\user\Oddking\Document\MySource\Widget\foo.src(带圆点)
也文件扩展名。只需在没有点的情况下存储,如果文件上没有点,它就没有扩展名。
(E)C:\User\Oddking\Document\MySource**Widget\foo.src
树顶
没有约定,吉特称之为基目录
(F)C:\User\Oddking\Document\My Source**Widget\foo.src**
从树顶到叶子的路径
相对路径
(G)C:\User\Oddking\Document\My Source**Widget**\fo.src
树的一个节点
没有约定,也许是个简单的目录
(H)C:\User\Oddking\Documents\MySource\Widget**f.src
dir名称
(I)C:\User\OddThinking\Documents\MySource\Widget\foo.src
完全/绝对路径
https://stackoverflow.com/questions/-100003216
复制相似问题