feat: goose windows (#880)
Co-authored-by: Ryan Versaw <ryan@versaw.com>
This commit is contained in:
@@ -62,12 +62,29 @@ pub async fn handle_configure() -> Result<(), Box<dyn Error>> {
|
||||
);
|
||||
}
|
||||
Some(ConfigError::KeyringError(msg)) => {
|
||||
#[cfg(target_os = "macos")]
|
||||
println!(
|
||||
"\n {} Failed to access secure storage (keyring): {} \n Please check your system keychain and run '{}' again. \n If your system is unable to use the keyring, please try setting secret key(s) via environment variables.",
|
||||
style("Error").red().italic(),
|
||||
msg,
|
||||
style("goose configure").cyan()
|
||||
);
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
println!(
|
||||
"\n {} Failed to access Windows Credential Manager: {} \n Please check Windows Credential Manager and run '{}' again. \n If your system is unable to use the Credential Manager, please try setting secret key(s) via environment variables.",
|
||||
style("Error").red().italic(),
|
||||
msg,
|
||||
style("goose configure").cyan()
|
||||
);
|
||||
|
||||
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
|
||||
println!(
|
||||
"\n {} Failed to access secure storage: {} \n Please check your system's secure storage and run '{}' again. \n If your system is unable to use secure storage, please try setting secret key(s) via environment variables.",
|
||||
style("Error").red().italic(),
|
||||
msg,
|
||||
style("goose configure").cyan()
|
||||
);
|
||||
}
|
||||
Some(ConfigError::DeserializeError(msg)) => {
|
||||
println!(
|
||||
|
||||
@@ -12,7 +12,12 @@ use goose::tracing::langfuse_layer;
|
||||
/// Returns the directory where log files should be stored.
|
||||
/// Creates the directory structure if it doesn't exist.
|
||||
fn get_log_directory() -> Result<PathBuf> {
|
||||
let home = std::env::var("HOME").context("HOME environment variable not set")?;
|
||||
let home = if cfg!(windows) {
|
||||
std::env::var("USERPROFILE").context("USERPROFILE environment variable not set")?
|
||||
} else {
|
||||
std::env::var("HOME").context("HOME environment variable not set")?
|
||||
};
|
||||
|
||||
let base_log_dir = PathBuf::from(home)
|
||||
.join(".config")
|
||||
.join("goose")
|
||||
@@ -114,7 +119,11 @@ mod tests {
|
||||
|
||||
fn setup_temp_home() -> TempDir {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
env::set_var("HOME", temp_dir.path());
|
||||
if cfg!(windows) {
|
||||
env::set_var("USERPROFILE", temp_dir.path());
|
||||
} else {
|
||||
env::set_var("HOME", temp_dir.path());
|
||||
}
|
||||
temp_dir
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user