ForNeVeR / ForNeVeR/TruePath

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

Open
#40 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
C#
Stars
104
Forks
15
Avg merge
9m
Merged PRs (30d)
2

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.