Skip to content

Use and return forward slash in Path sep even on Windows #1904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Bobris opened this issue Jun 5, 2015 · 6 comments
Closed

Use and return forward slash in Path sep even on Windows #1904

Bobris opened this issue Jun 5, 2015 · 6 comments
Labels
path Issues and PRs related to the path subsystem. windows Issues and PRs related to the Windows platform.

Comments

@Bobris
Copy link

Bobris commented Jun 5, 2015

Windows and DOS all the time supported both directory delimiters. Number of places in Windows where forward slashes are not allowed is very small and should be considered buggy.
Current situation makes writing platform independent code extremely complex, in many cases integration tests of projects created by Unix guys just don't work on Windows (and vice versa).

Finally this separation brings more harm then good.
It would also fix #616 - Path.relative would always return correct url separators.

I am not that naive, that I would expect this will be fixed, because it would probably break too many (probably mainly Windows) projects. But I would like to know view of node community about this problem.

@cjihrig
Copy link
Contributor

cjihrig commented Jun 5, 2015

I don't think it makes sense to change this. Using \ on Windows is more correct IMO. And, there is undoubtedly a ton of code in the ecosystem that relies on the existing behavior.

@mscdex
Copy link
Contributor

mscdex commented Jun 5, 2015

You can use the path.posix namespace on every platform to use / instead of the platform-dependent slash.

@mscdex mscdex added the path Issues and PRs related to the path subsystem. label Jun 5, 2015
@Bobris
Copy link
Author

Bobris commented Jun 5, 2015

@mscdex It is not bad idea. In some cases it is really used everywhere in project - every npm module, so in that case would you advice to monkey patch require or there is better way?

@mscdex
Copy link
Contributor

mscdex commented Jun 5, 2015

@Bobris Well, probably adding url.relative() would be better and having module authors use that instead of path.relative(). If url.relative() doesn't get added for some reason, then authors should probably use path.posix.relative(). However that obviously won't work for node v0.10 if people care about that.

@Fishrock123
Copy link
Contributor

What would this make better that justifies potential ecosystem breakage?

@Fishrock123 Fishrock123 added the windows Issues and PRs related to the Windows platform. label Jun 10, 2015
@Fishrock123
Copy link
Contributor

Closing, The ecosystem is already quite heavily built on this. :s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
path Issues and PRs related to the path subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

4 participants