Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was 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

Description

@misterdjules

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions