Skip to content

Commit e3d745f

Browse files
authored
Merge pull request #391 from wannanbigpig/feature-codex-cli-detection
优化codex cli检测
2 parents 266cd7d + 456ad12 commit e3d745f

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

src-tauri/src/modules/codex_wakeup.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,24 @@ fn collect_path_dirs() -> Vec<PathBuf> {
614614
.unwrap_or_default()
615615
}
616616

617+
fn append_home_cli_dirs(dirs: &mut Vec<PathBuf>) {
618+
let Some(home) = std::env::var_os("HOME") else {
619+
return;
620+
};
621+
622+
let home = PathBuf::from(home);
623+
for dir in [
624+
home.join(".npm-global/bin"),
625+
home.join(".local/bin"),
626+
home.join(".cargo/bin"),
627+
home.join(".volta/bin"),
628+
home.join(".yarn/bin"),
629+
home.join("bin"),
630+
] {
631+
push_unique_dir(dirs, dir);
632+
}
633+
}
634+
617635
#[cfg(target_os = "macos")]
618636
fn append_platform_cli_dirs(dirs: &mut Vec<PathBuf>) {
619637
for dir in [
@@ -624,6 +642,7 @@ fn append_platform_cli_dirs(dirs: &mut Vec<PathBuf>) {
624642
] {
625643
push_unique_dir(dirs, PathBuf::from(dir));
626644
}
645+
append_home_cli_dirs(dirs);
627646
}
628647

629648
#[cfg(target_os = "windows")]
@@ -634,7 +653,9 @@ fn append_platform_cli_dirs(dirs: &mut Vec<PathBuf>) {
634653
}
635654

636655
#[cfg(all(not(target_os = "macos"), not(target_os = "windows")))]
637-
fn append_platform_cli_dirs(_dirs: &mut Vec<PathBuf>) {}
656+
fn append_platform_cli_dirs(dirs: &mut Vec<PathBuf>) {
657+
append_home_cli_dirs(dirs);
658+
}
638659

639660
fn collect_runtime_search_dirs() -> Vec<PathBuf> {
640661
let mut dirs = collect_path_dirs();

0 commit comments

Comments
 (0)