Description
On Unix file system, it's always possible to build a relative path between two paths. On Windows, however, it is not universally possible: say, between different disks or between a DOS device and a disk. The latter aspect often surprises people when they use java.nio.file.Path::relativize
(that throws an exception), so we better do something else: either show the nature of the method in its type, or invent an alternate behavior.
Also, it is not possible between network shares.
We should decide and document the behavior of this method for these cases.
I am thinking about leaving a strict method that would return null
for cases when it was unable to build a path, and a separate lax method like RelativeToIfPossible
that would return this
for such cases.