Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Fixed login failure with API key in IDE extension when a `.codex` directory doesn't exist (#4258)

Eric Traut9f2ab97fbcaa
diff --git a/codex-rs/core/src/auth.rs b/codex-rs/core/src/auth.rs
index a2158310dc..5ba6fdf7b2 100644
--- a/codex-rs/core/src/auth.rs
+++ b/codex-rs/core/src/auth.rs
@@ -267,6 +267,9 @@ pub fn try_read_auth_json(auth_file: &Path) -> std::io::Result<AuthDotJson> {
}
pub fn write_auth_json(auth_file: &Path, auth_dot_json: &AuthDotJson) -> std::io::Result<()> {
+ if let Some(parent) = auth_file.parent() {
+ std::fs::create_dir_all(parent)?;
+ }
let json_data = serde_json::to_string_pretty(auth_dot_json)?;
let mut options = OpenOptions::new();
options.truncate(true).write(true).create(true);