How to .resolve*() and .relativize() Paths which are not issued from the same FileSystem?
Alan.Bateman at oracle.com
Sun Nov 30 20:43:59 UTC 2014
On 30/11/2014 17:19, Francis Galiegue wrote:
> And this reminds me of another question I had about that: why does the
> Path API make a difference between having a root component and being
> absolute? In other words, is there possibly a case where a Path is
> absolute but has no root component or the reverse?
The most obvious example is on Windows where paths such "C:foo" and
"\foo" have root components but are not absolute paths.
> I don't see how this is a problem since the goal is to have a path
> suitable for the filesystem of p2; I mean, if you resolve against a
> string, you are supposed to create a path against the target
> filesystem, right? As such why would the internal representation of p1
Converting to a String might be lossy, esp. if the internal
representation is bytes. So if p1 and p2 are associated with the same
file system provider then you can preserve the internal representation.
We don't have a solution for this when converting name elements from one
file system provider to another.
More information about the nio-dev