Use paths::external_agents_dir (#41286)

We were not actually using `paths::agent_servers` and were manually
constructing the path to the `external_agents` folder in a few places.

Release Notes:

- N/A
This commit is contained in:
Bennet Fenner
2025-10-27 15:24:44 +00:00
committed by GitHub
parent 370d4ce200
commit ebf4a23b18
2 changed files with 7 additions and 9 deletions
+4 -4
View File
@@ -370,12 +370,12 @@ pub fn debug_adapters_dir() -> &'static PathBuf {
DEBUG_ADAPTERS_DIR.get_or_init(|| data_dir().join("debug_adapters"))
}
/// Returns the path to the agent servers directory
/// Returns the path to the external agents directory
///
/// This is where agent servers are downloaded to
pub fn agent_servers_dir() -> &'static PathBuf {
static AGENT_SERVERS_DIR: OnceLock<PathBuf> = OnceLock::new();
AGENT_SERVERS_DIR.get_or_init(|| data_dir().join("agent_servers"))
pub fn external_agents_dir() -> &'static PathBuf {
static EXTERNAL_AGENTS_DIR: OnceLock<PathBuf> = OnceLock::new();
EXTERNAL_AGENTS_DIR.get_or_init(|| data_dir().join("external_agents"))
}
/// Returns the path to the Copilot directory.
+3 -5
View File
@@ -773,9 +773,7 @@ fn get_or_npm_install_builtin_agent(
) -> Task<std::result::Result<AgentServerCommand, anyhow::Error>> {
cx.spawn(async move |cx| {
let node_path = node_runtime.binary_path().await?;
let dir = paths::data_dir()
.join("external_agents")
.join(binary_name.as_str());
let dir = paths::external_agents_dir().join(binary_name.as_str());
fs.create_dir(&dir).await?;
let mut stream = fs.read_dir(&dir).await?;
@@ -1246,7 +1244,7 @@ impl ExternalAgentServer for LocalCodex {
custom_command.env = Some(env);
custom_command
} else {
let dir = paths::data_dir().join("external_agents").join(CODEX_NAME);
let dir = paths::external_agents_dir().join(CODEX_NAME);
fs.create_dir(&dir).await?;
// Find or install the latest Codex release (no update checks for now).
@@ -1418,7 +1416,7 @@ impl ExternalAgentServer for LocalExtensionArchiveAgent {
env.extend(extra_env);
let cache_key = format!("{}/{}", extension_id, agent_id);
let dir = paths::data_dir().join("external_agents").join(&cache_key);
let dir = paths::external_agents_dir().join(&cache_key);
fs.create_dir(&dir).await?;
// Determine platform key