on master help sign in
Canonicalize executable path
b5be72bBen Noordhuis
helix-loader/src/lib.rs+2
@@ -42,8 +42,10 @@ pub fn runtime_dir() -> PathBuf {
42 }
42 }
43
43
44 // fallback to location of the executable being run
44 // fallback to location of the executable being run
45+ // canonicalize the path in case the executable is symlinked
45 std::env::current_exe()
46 std::env::current_exe()
46 .ok()
47 .ok()
48+ .and_then(|path| std::fs::canonicalize(path).ok())
47 .and_then(|path| path.parent().map(|path| path.to_path_buf().join(RT_DIR)))
49 .and_then(|path| path.parent().map(|path| path.to_path_buf().join(RT_DIR)))
48 .unwrap()
50 .unwrap()
49}
51}