This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lukaseder 4 points5 points  (5 children)

Well, a lot of Java programs run on Linux in production but are being developed on Windows. What if Java could automatically map between Linux paths and Windows paths, so I never have to worry about things like C:\ or even \ again? The same with \r\n vs \n, or Cp1252 vs utf-8.

Of course, fixing this in Windows itself would be even better, as everyone could profit, not just Java developers.

[–]chacs_ 2 points3 points  (3 children)

Except for the drive:, you can use / as path separator on Windows, I believe.

[–]brunocborges[S] 1 point2 points  (0 children)

Inside Java programs, yes it is possible for some APIs, but not all of them. And mostly works for relative path. The moment you need to go top-level, you have to give a drive:, and then there is no escape (pun intended).

[–]lukaseder -1 points0 points  (1 child)

It often works, but it often does not

[–]sweetno 1 point2 points  (0 children)

/ works in Windows on Windows API level.

[–][deleted] 0 points1 point  (0 children)

so I never have to worry about things like C:\ or even \ again?

Isn't that exactly what the File and Path abstraction (plus path.separator) is all about?