phpup/version/
system.rs

1use std::path::PathBuf;
2use which::which_all;
3
4pub fn path() -> Option<PathBuf> {
5    let multishell_path_dir = std::env::temp_dir().join("phpup");
6    which_all("php")
7        .ok()
8        .into_iter()
9        .flatten()
10        .find(|bin_path| !bin_path.starts_with(&multishell_path_dir))
11        .and_then(|path| path.parent().map(ToOwned::to_owned))
12}
13
14#[cfg(test)]
15mod test {
16    use super::*;
17
18    #[test]
19    fn test() {
20        let system_path = path();
21        println!("{:?}", system_path);
22    }
23}