What is the naming standard for path components?

后端 未结 8 1562
广开言路
广开言路 2020-12-22 15:22

I keep getting myself in knots when I am manipulating paths and file names because I don’t follow a naming standard for path components.

Consider the following toy pr

8条回答
  •  一个人的身影
    2020-12-22 16:08

    A) foo

    filename without extension

    B) foo.src

    filename

    C) src

    extension without dot

    D) .src

    extension

    E) C:\users\OddThinking\Documents\My Source\ - i.e. the top of the tree.

    [absolute] (working | current | active | root) directory path

    F) Widget\foo.src - i.e. the path from the top of the tree to the leaf.

    relative file path

    G) Widget - i.e. one node of the tree.

    directory name

    H) C:\users\OddThinking\Documents\My Source\Widget\ - i.e. the name of the folder

    [absolute] directory path

    I) C:\users\OddThinking\Documents\My Source\Widget\foo.src

    [absolute] file path

    "Filename" is a word, so generally we should probably use "filename" and not "file name" (and Filename not FileName).

    We're working at a lower level, so we should probably call them directories and not folders, but either would be ok if you were consistent.

提交回复
热议问题