Skip to content

Specify behavior of *Path::RelativeTo for cases when it's impossible to build a relative path #40

Open
@ForNeVeR

Description

@ForNeVeR

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions