Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ForNeVeR opened this issue Apr 28, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ForNeVeR
Copy link
Owner

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.

@ForNeVeR ForNeVeR added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant