From Jason Turner

[fs.path.generic]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpndoe8xas/{from.md → to.md} +46 -10
tmp/tmpndoe8xas/{from.md → to.md} RENAMED
@@ -42,31 +42,42 @@ preferred-separator:
42
  ``` bnf
43
  fallback-separator:
44
  /, if *preferred-separator* is not /
45
  ```
46
 
47
- [*Note 1*: Operating systems often place restrictions on the characters
48
- that may be used in a *filename*. For wide portability, users may wish
49
- to limit *filename* characters to the POSIX Portable Filename Character
50
- Set:
 
 
 
 
 
 
51
  `A B C D E F G H I J K L M N O P Q R S T U V W X Y Z`
52
  `a b c d e f g h i j k l m n o p q r s t u v w x y z`
53
  `0 1 2 3 4 5 6 7 8 9 . _ -` — *end note*]
 
 
 
 
 
 
54
 
55
  Except in a *root-name*, multiple successive *directory-separator*
56
  characters are considered to be the same as one *directory-separator*
57
  character.
58
 
59
- The filename *dot* ([[fs.def.filename]]) is treated as a reference to
60
- the current directory. The filename *dot-dot* ([[fs.def.filename]]) is
61
- treated as a reference to the parent directory. What the filename
62
- *dot-dot* refers to relative to *root-directory* is
63
  *implementation-defined*. Specific filenames may have special meanings
64
  for a particular operating system.
65
 
66
- A *root-name* identifies the starting location for pathname resolution (
67
- [[fs.def.pathres]]). If there are no operating system dependent
68
  *root-name*s, at least one *implementation-defined* *root-name* is
69
  required.
70
 
71
  [*Note 2*: Many operating systems define a name beginning with two
72
  *directory-separator* characters as a *root-name* that identifies
@@ -79,5 +90,30 @@ longest sequence of characters is chosen.
79
 
80
  [*Note 3*: On a POSIX-like operating system, it is impossible to have a
81
  *root-name* and a *relative-path* without an intervening
82
  *root-directory* element. — *end note*]
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ``` bnf
43
  fallback-separator:
44
  /, if *preferred-separator* is not /
45
  ```
46
 
47
+ A *filename* is the name of a file. The *dot* and *dot-dot* filenames,
48
+ consisting solely of one and two period characters respectively, have
49
+ special meaning. The following characteristics of filenames are
50
+ operating system dependent:
51
+
52
+ - The permitted characters. \[*Example 1*: Some operating systems
53
+ prohibit the ASCII control characters (0x00 – 0x1F) in
54
+ filenames. — *end example*] \[*Note 1*: For wide portability, users
55
+ may wish to limit *filename* characters to the POSIX Portable Filename
56
+ Character Set:
57
  `A B C D E F G H I J K L M N O P Q R S T U V W X Y Z`
58
  `a b c d e f g h i j k l m n o p q r s t u v w x y z`
59
  `0 1 2 3 4 5 6 7 8 9 . _ -` — *end note*]
60
+ - The maximum permitted length.
61
+ - Filenames that are not permitted.
62
+ - Filenames that have special meaning.
63
+ - Case awareness and sensitivity during path resolution.
64
+ - Special rules that may apply to file types other than regular files,
65
+ such as directories.
66
 
67
  Except in a *root-name*, multiple successive *directory-separator*
68
  characters are considered to be the same as one *directory-separator*
69
  character.
70
 
71
+ The dot filename is treated as a reference to the current directory. The
72
+ dot-dot filename is treated as a reference to the parent directory. What
73
+ the dot-dot filename refers to relative to *root-directory* is
 
74
  *implementation-defined*. Specific filenames may have special meanings
75
  for a particular operating system.
76
 
77
+ A *root-name* identifies the starting location for pathname resolution
78
+ [[fs.class.path]]. If there are no operating system dependent
79
  *root-name*s, at least one *implementation-defined* *root-name* is
80
  required.
81
 
82
  [*Note 2*: Many operating systems define a name beginning with two
83
  *directory-separator* characters as a *root-name* that identifies
 
90
 
91
  [*Note 3*: On a POSIX-like operating system, it is impossible to have a
92
  *root-name* and a *relative-path* without an intervening
93
  *root-directory* element. — *end note*]
94
 
95
+ *Normalization* of a generic format pathname means:
96
+
97
+ 1. If the path is empty, stop.
98
+ 2. Replace each slash character in the *root-name* with a
99
+ *preferred-separator*.
100
+ 3. Replace each *directory-separator* with a *preferred-separator*.
101
+ \[*Note 4*: The generic pathname grammar [[fs.path.generic]] defines
102
+ *directory-separator* as one or more slashes and
103
+ *preferred-separator*s. — *end note*]
104
+ 4. Remove each dot filename and any immediately following
105
+ *directory-separator*.
106
+ 5. As long as any appear, remove a non-dot-dot filename immediately
107
+ followed by a *directory-separator* and a dot-dot filename, along
108
+ with any immediately following *directory-separator*.
109
+ 6. If there is a *root-directory*, remove all dot-dot filenames and any
110
+ *directory-separator*s immediately following them. \[*Note 5*: These
111
+ dot-dot filenames attempt to refer to nonexistent parent
112
+ directories. — *end note*]
113
+ 7. If the last filename is dot-dot, remove any trailing
114
+ *directory-separator*.
115
+ 8. If the path is empty, add a dot.
116
+
117
+ The result of normalization is a path in *normal form*, which is said to
118
+ be *normalized*.
119
+