Skip to content

Commit

Permalink
Canonicalize executable path
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bnoordhuis authored and CBenoit committed Sep 13, 2022
1 parent ec81ec1 commit b5be72b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions helix-loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit b5be72b

Please sign in to comment.