path.sep
新增于: v0.7.9
提供特定于平台的路径片段分隔符:
\Provides the platform-specific path segment separator:
-
Windows 上是
\\
\on Windows -
POSIX 上是
/\
/on POSIX
例如,在 POSIX 上:
\For example, on POSIX:
'foo/bar/baz'.split(path.sep);
// Returns: ['foo', 'bar', 'baz'] 在 Windows 上:
\On Windows:
'foo\\bar\\baz'.split(path.sep);
// Returns: ['foo', 'bar', 'baz'] 在 Windows 上,正斜杠 (/) 和反斜杠 (\) 都被接受为路径段分隔符;但是,path 方法仅添加反斜杠 (\)。
\On Windows, both the forward slash (/) and backward slash (\) are accepted
as path segment separators; however, the path methods only add backward
slashes (\).