mirror of
https://github.com/FliegendeWurst/ripgrep-all.git
synced 2024-11-24 12:24:56 +00:00
change binary search path, fix #32
This commit is contained in:
parent
da10b5c1c9
commit
9f11906151
@ -116,9 +116,11 @@ fn add_exe_to_path() -> Fallible<()> {
|
|||||||
exe.pop(); // dirname
|
exe.pop(); // dirname
|
||||||
|
|
||||||
let path = env::var_os("PATH").unwrap_or("".into());
|
let path = env::var_os("PATH").unwrap_or("".into());
|
||||||
let mut paths = env::split_paths(&path).collect::<Vec<_>>();
|
let paths = env::split_paths(&path).collect::<Vec<_>>();
|
||||||
paths.push(exe.to_owned()); // append: this way system PATH gets higher priority than bundled versions
|
// prepend: prefer bundled versions to system-installed versions of binaries
|
||||||
paths.push(exe.join("lib"));
|
// solves https://github.com/phiresky/ripgrep-all/issues/32
|
||||||
|
// may be somewhat of a security issue if rga binary is in installed in unprivileged locations
|
||||||
|
let paths = [&[exe.to_owned(), exe.join("lib")], &paths[..]].concat();
|
||||||
let new_path = env::join_paths(paths)?;
|
let new_path = env::join_paths(paths)?;
|
||||||
env::set_var("PATH", &new_path);
|
env::set_var("PATH", &new_path);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user