-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Description
- Version: Node 6.4
- Platform: OSX, Windows 10 64bit
- Subsystems: process, path
In various case-insensitive platforms - namely, Windows and OSX - it is possible to cd into an incorrectly-cased path. Node handles this differently on Windows than it does in OSX when attempting to resolve process.cwd(). This affects other modules - namely, how path.resolve() cases its absolute paths.
In OSX, process.cwd() resolves to the correctly cased path, regardless of which path you have cded into. I believe this to be correct behavior.
~/my-app$ node
> process.cwd()
'/Users/michael.pratt/my-app`
~/my-app$ cd ../My-app
~/My-app$ node
> process.cwd()
'/Users/michael.pratt/my-app`
In Windows default console, it is not possible to cd into an incorrect path. However, using PowerShell or the new Bash for Windows, it is possible, but process.cwd() resolves to the incorrect path casing - not matching what is on disk.
PS C:\Users\Michael Pratt\my-app> node
> process.cwd()
'C:\\Users\\Michael Pratt\\my-app'
PS C:\Users\Michael Pratt\my-app> cd ../My-app
PS C:\Users\Michael Pratt\My-app> node
> process.cwd()
'C:\\Users\\Michael Pratt\\My-app'
Again, I feel the OSX behavior is correct, as it matches what is on the filesystem.