forked from notify-rs/notify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not ignore symlinks pointing to regular files
- Loading branch information
Showing
1 changed file
with
6 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -456,7 +456,7 @@ impl EventLoop { | |
.into_iter() | ||
.filter_map(filter_dir) | ||
{ | ||
self.add_single_watch(entry.path().to_path_buf(), is_recursive, watch_self)?; | ||
self.add_single_watch(entry, is_recursive, watch_self)?; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
morenol
Author
Owner
|
||
watch_self = false; | ||
} | ||
|
||
|
@@ -557,13 +557,16 @@ impl EventLoop { | |
} | ||
|
||
/// return `DirEntry` when it is a directory | ||
fn filter_dir(e: walkdir::Result<walkdir::DirEntry>) -> Option<walkdir::DirEntry> { | ||
fn filter_dir(e: walkdir::Result<walkdir::DirEntry>) -> Option<PathBuf> { | ||
if let Ok(e) = e { | ||
if let Ok(metadata) = e.metadata() { | ||
if metadata.is_dir() { | ||
return Some(e); | ||
return Some(e.path().to_path_buf()); | ||
} | ||
} | ||
if e.path_is_symlink() { | ||
return std::fs::canonicalize(e.path()).ok(); | ||
} | ||
} | ||
None | ||
} | ||
|
why is that necessary ? to resolve the real file ?