Skip to content

Commit b5be72b

Browse files
bnoordhuisCBenoit
authored andcommitted
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
1 parent ec81ec1 commit b5be72b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

helix-loader/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

0 commit comments

Comments
 (0)