aboutsummaryrefslogtreecommitdiff
path: root/helix-loader
diff options
context:
space:
mode:
authorBen Noordhuis2022-09-11 07:13:45 +0000
committerBenoƮt Cortier2022-09-13 21:50:02 +0000
commitb5be72bff79075ef4b5b51922da15e003c274b9b (patch)
tree6e9db0b376c3a0a8da3bde45f6560ec4de546446 /helix-loader
parentec81ec1e8d26e3a99ed713b79381a77daf817d34 (diff)
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
Diffstat (limited to 'helix-loader')
-rw-r--r--helix-loader/src/lib.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs
index 015b39a5..3c9905f5 100644
--- a/helix-loader/src/lib.rs
+++ b/helix-loader/src/lib.rs
@@ -42,8 +42,10 @@ pub fn runtime_dir() -> PathBuf {
}
// fallback to location of the executable being run
+ // canonicalize the path in case the executable is symlinked
std::env::current_exe()
.ok()
+ .and_then(|path| std::fs::canonicalize(path).ok())
.and_then(|path| path.parent().map(|path| path.to_path_buf().join(RT_DIR)))
.unwrap()
}