-
- Notifications
You must be signed in to change notification settings - Fork 510
Closed
Description
Description of issue
As many folks are aware, much of the world has sandardized on forward slashes as path / folder delimiters (eg /path/to/your/file.txt or https://domain.com/path/to/your/view).
Windows, however, has historically relied on backslashes (eg C:\path\to\your\file.txt).
Node, of course, respects both per-platform:
- *nix:
console.log(process.cwd()) // /path/to/current/folder - Win:
console.log(process.cwd()) // C:\\path\\to\\current\\folder
When node-glob returns results on Windows, it outputs them with forward slash-normalized paths. This can cause cross-platform compatibility problems.
Example:
let files = glob.sync('*') let relativePaths = files.map(file => file.replace(path.join(process.cwd(), path.sep))) In Windows, the above code would not work, as using methods intended to ease cross platform compatibility (like path.sep) break with node-glob's forward-slash normalized output.
Expected behavior
- Glob would output file paths that are platform-native and that can be used without additional denormalization steps
Repro steps
- Glob files on Windows; file paths are normalized to forward slashes
- Compare to
process.cwd(), etc. in Windows; file Node presents backslash-normalized file paths
Metadata
Metadata
Assignees
Labels
No labels