mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
switch checking for str.zig to be relative to the exectuable
This commit is contained in:
parent
28146c939f
commit
d47c4616f2
2 changed files with 40 additions and 44 deletions
|
@ -4,36 +4,6 @@ use std::{
|
|||
process::Command,
|
||||
};
|
||||
|
||||
// get the path of the lib folder
|
||||
// runtime dependencies like zig files, Windows dylib builds, are put in the lib folder
|
||||
pub fn get_lib_path() -> Option<PathBuf> {
|
||||
let exe_relative_str_path_opt = std::env::current_exe().ok();
|
||||
|
||||
if let Some(exe_relative_str_path) = exe_relative_str_path_opt {
|
||||
#[cfg(windows)]
|
||||
let exe_relative_str_path = strip_windows_prefix(&exe_relative_str_path);
|
||||
|
||||
let mut curr_parent_opt = exe_relative_str_path.parent();
|
||||
|
||||
// this differs for regular build and nix releases, so we check in multiple spots.
|
||||
for _ in 0..3 {
|
||||
if let Some(curr_parent) = curr_parent_opt {
|
||||
let lib_path = curr_parent.join("lib");
|
||||
|
||||
if std::path::Path::exists(&lib_path) {
|
||||
return Some(lib_path);
|
||||
} else {
|
||||
curr_parent_opt = curr_parent.parent();
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
use std::path::Path;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue