Skip to content

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

fix(agy): find agy.exe installed by the Antigravity desktop installer on Windows

Jasonab96ccbfedea
diff --git a/src-tauri/src/agy_config.rs b/src-tauri/src/agy_config.rs
index 2a20113cb..0ee5c17e3 100644
--- a/src-tauri/src/agy_config.rs
+++ b/src-tauri/src/agy_config.rs
@@ -1037,12 +1037,8 @@ pub(crate) fn background_command(bin: &Path) -> tokio::process::Command {
/// 旧版测试装的包装脚本永远不会被返回。
pub(crate) fn real_agy_bin() -> Option<PathBuf> {
let path_var = std::env::var_os("PATH").unwrap_or_default();
- // install.ps1 installs to %LOCALAPPDATA%\agy\bin, which a GUI process's PATH may lack.
let system_dirs: Vec<PathBuf> = if cfg!(windows) {
- dirs::data_local_dir()
- .map(|dir| dir.join("agy").join("bin"))
- .into_iter()
- .collect()
+ windows_agy_dirs(dirs::data_local_dir(), &get_home_dir())
} else {
vec![
PathBuf::from("/opt/homebrew/bin"),
@@ -1057,6 +1053,18 @@ pub(crate) fn real_agy_bin() -> Option<PathBuf> {
)
}
+/// Windows 上不在 PATH 里的安装位置(GUI 进程的 PATH 常缺用户级条目):
+/// install.ps1 装到 `%LOCALAPPDATA%\agy\bin`;只装了桌面版时 `agy.exe` 在
+/// `%USERPROFILE%\.gemini\bin`,安装器不把它加进 PATH(#10105)。
+fn windows_agy_dirs(local_data: Option<PathBuf>, home: &Path) -> Vec<PathBuf> {
+ let mut dirs: Vec<PathBuf> = local_data
+ .map(|dir| dir.join("agy").join("bin"))
+ .into_iter()
+ .collect();
+ dirs.push(home.join(".gemini").join("bin"));
+ dirs
+}
+
fn resolve_real_agy(
path_var: &std::ffi::OsStr,
home: &Path,
@@ -1234,6 +1242,22 @@ mod legacy {
mod tests {
use super::*;
+ #[test]
+ fn windows_dirs_include_desktop_installer_bin_after_install_script_dir() {
+ let home = Path::new("/home/me");
+ assert_eq!(
+ windows_agy_dirs(Some(PathBuf::from("/local")), home),
+ vec![
+ PathBuf::from("/local/agy/bin"),
+ PathBuf::from("/home/me/.gemini/bin")
+ ]
+ );
+ assert_eq!(
+ windows_agy_dirs(None, home),
+ vec![PathBuf::from("/home/me/.gemini/bin")]
+ );
+ }
+
fn patched(patch: &JsonPatch, before: &str) -> Value {
let bytes = patch
.apply(Path::new("settings.json"), Some(before.as_bytes()))
diff --git a/src-tauri/src/commands/tool_discovery.rs b/src-tauri/src/commands/tool_discovery.rs
index 189ee159e..c06dad040 100644
--- a/src-tauri/src/commands/tool_discovery.rs
+++ b/src-tauri/src/commands/tool_discovery.rs
@@ -623,6 +623,11 @@ pub(super) fn build_tool_search_paths(tool: &str) -> Vec<std::path::PathBuf> {
push_unique_path(&mut search_paths, local_data.join("agy").join("bin"));
}
}
+ if tool == "agy" && !home.as_os_str().is_empty() {
+ // The Antigravity desktop installer ships `agy.exe` here without
+ // adding it to PATH (#10105).
+ push_unique_path(&mut search_paths, home.join(".gemini").join("bin"));
+ }
if let Some(appdata) = dirs::data_dir() {
push_unique_path(&mut search_paths, appdata.join("npm"));
if tool == "hermes" {