Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/document.rs')
| -rw-r--r-- | helix-view/src/document.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index b8d318bb..23b597a3 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -895,7 +895,15 @@ impl Document { } let write_path = tokio::fs::read_link(&path) .await - .unwrap_or_else(|_| path.clone()); + .ok() + .and_then(|p| { + if p.is_relative() { + path.parent().map(|parent| parent.join(p)) + } else { + Some(p) + } + }) + .unwrap_or_else(|| path.clone()); if readonly(&write_path) { bail!(std::io::Error::new( |