Strange "..\" on Windows

Weijun Wang weijun.wang at oracle.com
Fri Oct 23 09:38:22 UTC 2015


Paths.get("x").relativize(Paths.get("")) returns ..\ on Windows, which 
is not the same as Paths.get("..\\") (which shows as ..). In fact, its 
getName(0).toString() is exactly ..\.

It looks like the \ is not treated as a path separator.

Also, Paths.get("x/y").relativize(Paths.get("")) returns ..\..\ on 
Windows, but its getName(0) is .. and getName(1) is ..\

On Mac, it's all normal.

Is this a bug?

Thanks
Max

p.s. I run in cygwin of Windows 10.




More information about the nio-dev mailing list