fix(io): handle relative paths in Watcher by converting to absolute p… #3553
+13
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Handle Relative Paths in Watcher by Converting to Absolute Paths
Which issue does this PR close?
fs2.io.Watcher#watch
with a relative path to file causes an NPE #3472Rationale for this change
This update fixes a NullPointerException (NPE) that occurs when watching files with relative paths by converting them to absolute paths before registration. This ensures that the file watcher can handle relative paths correctly.
What changes are included in this PR?
Are these changes tested?
Yes, the changes are tested to ensure that the Watcher can handle relative paths without causing a NullPointerException.
Are there any user-facing changes?
No, there are no user-facing changes as this update is related to internal path handling improvements.
Are there any breaking changes to public APIs?
No, there are no breaking changes to public APIs.
Additional Information
Thanks for opening a PR!
If the CI build fails due to Scalafmt, run
sbt scalafmtAll
and push the changes (generally a good idea to run this prior to opening the PR).It's also helpful to run
sbt prePR
, which runs tests, generates docs, and performs various checks.Feel free to ask questions on the fs2 and fs2-dev channels on the Typelevel Discord server.