|
@ -14,7 +14,7 @@ Normalize a string path, taking care of `'..'` and `'.'` parts. |
|
|
|
|
|
|
|
|
When multiple slashes are found, they're replaced by a single one; |
|
|
When multiple slashes are found, they're replaced by a single one; |
|
|
when the path contains a trailing slash, it is preserved. |
|
|
when the path contains a trailing slash, it is preserved. |
|
|
On windows backslashes are used. |
|
|
On Windows backslashes are used. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -143,14 +143,36 @@ an empty string. Examples: |
|
|
|
|
|
|
|
|
The platform-specific file separator. `'\\'` or `'/'`. |
|
|
The platform-specific file separator. `'\\'` or `'/'`. |
|
|
|
|
|
|
|
|
An example on linux: |
|
|
An example on *nix: |
|
|
|
|
|
|
|
|
'foo/bar/baz'.split(path.sep) |
|
|
'foo/bar/baz'.split(path.sep) |
|
|
// returns |
|
|
// returns |
|
|
['foo', 'bar', 'baz'] |
|
|
['foo', 'bar', 'baz'] |
|
|
|
|
|
|
|
|
An example on windows: |
|
|
An example on Windows: |
|
|
|
|
|
|
|
|
'foo\\bar\\baz'.split(path.sep) |
|
|
'foo\\bar\\baz'.split(path.sep) |
|
|
// returns |
|
|
// returns |
|
|
['foo', 'bar', 'baz'] |
|
|
['foo', 'bar', 'baz'] |
|
|
|
|
|
|
|
|
|
|
|
## path.delimiter |
|
|
|
|
|
|
|
|
|
|
|
The platform-specific path delimiter, `;` or `':'`. |
|
|
|
|
|
|
|
|
|
|
|
An example on *nix: |
|
|
|
|
|
|
|
|
|
|
|
console.log(process.env.PATH) |
|
|
|
|
|
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' |
|
|
|
|
|
|
|
|
|
|
|
process.env.PATH.split(path.delimiter) |
|
|
|
|
|
// returns |
|
|
|
|
|
['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] |
|
|
|
|
|
|
|
|
|
|
|
An example on Windows: |
|
|
|
|
|
|
|
|
|
|
|
console.log(process.env.PATH) |
|
|
|
|
|
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\' |
|
|
|
|
|
|
|
|
|
|
|
process.env.PATH.split(path.delimiter) |
|
|
|
|
|
// returns |
|
|
|
|
|
['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\'] |
|
|