Canonicalize executable path
When looking up the runtime/ directory relative to the executable path,
canonicalize the path first in case the executable is a symbolic link.
Fixes #3768
commitb5be72bff79075ef4b5b51922da15e003c274b9b
authorBen Noordhuis <info@bnoordhuis.nl>
dateSun 11 Sep 2022, 09:13 (4 years ago)
parentec81ec1
helix-loader/src/lib.rs+2
@@ -42,8 +42,10 @@ pub fn runtime_dir() -> PathBuf {
4242 }
4343
4444 // fallback to location of the executable being run
45+ // canonicalize the path in case the executable is symlinked
4546 std::env::current_exe()
4647 .ok()
48+ .and_then(|path| std::fs::canonicalize(path).ok())
4749 .and_then(|path| path.parent().map(|path| path.to_path_buf().join(RT_DIR)))
4850 .unwrap()
4951}