Path of "." and ""

Wang Weijun weijun.wang at oracle.com
Tue Dec 9 00:07:16 UTC 2014


> On Dec 9, 2014, at 05:42, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> On 08/12/2014 10:37, Wang Weijun wrote:
>>> :
>>> 
>>> I also noticed that even if the startsWith method returns false, the p1.relativize(p2) returns a simple "s".
>>> 
> For this example then p1 is the empty path and p2 is "s".  Accessing a file using the empty path is equivalent to accessing the default directory. The relative path to get from the default directory to "s" is "s", so I think what you have is correct.

Yes, but why doesn't a path inside the default directory start with the directory itself? Or does this mean the current normalized form is still not the most normalized one?

Another thing I see is that "..".relativize("x") is "../x", while actually it should be "pwd/x". Of course we don't know what "pwd" is, but why not throw an exception?

--Max

> 
> -Alan.



More information about the nio-dev mailing list