mirror of
https://github.com/openai/codex.git
synced 2026-05-18 18:22:39 +00:00
Keep runtime archive download and validation in exec-server, but move bundled marketplace and skill materialization into app-server orchestration using the selected environment filesystem. Surface the exec-server codexHome during initialization so remote installs materialize into the remote environment's Codex home.\n\nCo-authored-by: Codex <noreply@openai.com>
27 lines
898 B
Rust
27 lines
898 B
Rust
use std::path::PathBuf;
|
|
|
|
use codex_app_server_protocol::JSONRPCErrorError;
|
|
use codex_utils_absolute_path::AbsolutePathBuf;
|
|
|
|
use crate::rpc::internal_error;
|
|
|
|
pub(crate) fn default_codex_home() -> Result<AbsolutePathBuf, JSONRPCErrorError> {
|
|
default_codex_home_path()
|
|
.and_then(|path| {
|
|
AbsolutePathBuf::from_absolute_path_checked(path)
|
|
.map_err(|err| format!("runtime codex home is not absolute: {err}"))
|
|
})
|
|
.map_err(internal_error)
|
|
}
|
|
|
|
pub(crate) fn default_codex_home_path() -> Result<PathBuf, String> {
|
|
if let Some(codex_home) = std::env::var_os("CODEX_HOME") {
|
|
return Ok(PathBuf::from(codex_home));
|
|
}
|
|
let home = std::env::var_os("HOME")
|
|
.or_else(|| std::env::var_os("USERPROFILE"))
|
|
.map(PathBuf::from)
|
|
.ok_or_else(|| "failed to locate home directory".to_string())?;
|
|
Ok(home.join(".codex"))
|
|
}
|