Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

platform specific path.resolve on a different platform fails for relative paths #9430

Closed
misterdjules opened this issue Mar 17, 2015 · 0 comments

Comments

@misterdjules
Copy link

Using path.posix.resolve on Windows with relative paths gives the following output:

C:\Users\jgilli\dev\node>.\Release\node.exe --version
v0.12.1-pre

C:\Users\jgilli\dev\node>.\Release\node.exe
> path.posix.resolve('foo/bar')
'C:\\Users\\jgilli\\dev\\node/foo/bar'
>

Using path.win32.resolve On OSX with relative paths gives:

➜  v0.12 git:(v0.12) ./node --version                       
v0.12.1-pre
➜  v0.12 git:(v0.12) ./node
> path.win32.resolve('foo\\bar');
'\\Users\\JulienGilli\\dev\\node\\v0.12\\foo\\bar'
> 

which at least doesn't mix forward slashes with backslashes, but the drive letter is missing.

I'm not sure what the proper way to fix this would be. I don't know if it even makes sense to be able to call the path.resolve platform-specific function with relative paths when node is running on a different platform, since path.resolve relies on process.cwd.

This discussion had started in a comment for another issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants