Skip to content
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

Use forward slashes for paths on Windows #957

Closed
ry opened this issue Oct 10, 2018 · 5 comments
Closed

Use forward slashes for paths on Windows #957

ry opened this issue Oct 10, 2018 · 5 comments

Comments

@ry
Copy link
Member

ry commented Oct 10, 2018

The backslash vs forward slash difference between Unix and Windows is one of the oldest yet continually painful parts of making cross-platform software.

Windows itself accepts forward slashes in most (all?) of its API at this point.

I suggest that Deno always output forward slash paths on Windows.

For example, deno.cwd() might return "/C:/Documents/Foo".

If we ensure that all APIs in Deno return forward slashes, we can alleviate this cross-platform issue from our users.

Issues:

  • In the Windows command line, arguments are specified using forward slash instead of dash. To solve this we will provide deno.pathBackwards(string): string. This will allow users to convert any forward slash path to the backward slash variety. This confines path portability issues to users who interact with such command line programs.
  • Paths may come from sources other than deno, and these paths may very well be using backslashes. To solve this we will ensure any Deno APIs that take paths do accept the backslash variety. Furthermore we will provide deno.pathForwards(string): string to convert into the forward slash variety.

cc @piscisaureus

@TehShrike
Copy link

This would make life way easier...

On what file systems/versions of Windows are forward-slashes handled?

@bartlomieju
Copy link
Member

Reference: #2572 - that PR should ensure that

@ry
Copy link
Member Author

ry commented Jun 25, 2019

Closing this because @piscisaureus objects.

@ry ry closed this as completed Jun 25, 2019
@bartlomieju
Copy link
Member

Closing this because @piscisaureus objects.

Could you elaborate? Does this block my idea to use forward slashes internally for DenoDir?

@ry
Copy link
Member Author

ry commented Jun 25, 2019

@bartlomieju #987 (comment)

Does this block my idea to use forward slashes internally for DenoDir?

No, I think that's fine... I mean, ideally we would use URLs which have saner semantics.

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

No branches or pull requests

3 participants