Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

linux: Fix issue where relative symlinks were not being watched using fs watch (#22608)

timse25789893dcf
diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs
index be9f3f4e0f4..2cf633c0210 100644
--- a/crates/fs/src/fs.rs
+++ b/crates/fs/src/fs.rs
@@ -720,7 +720,16 @@ impl Fs for RealFs {
}
// Check if path is a symlink and follow the target parent
- if let Some(target) = self.read_link(&path).await.ok() {
+ if let Some(mut target) = self.read_link(&path).await.ok() {
+ // Check if symlink target is relative path, if so make it absolute
+ if target.is_relative() {
+ if let Some(parent) = path.parent() {
+ target = parent.join(target);
+ if let Ok(canonical) = self.canonicalize(&target).await {
+ target = canonical;
+ }
+ }
+ }
watcher.add(&target).ok();
if let Some(parent) = target.parent() {
watcher.add(parent).log_err();