Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/config_default_credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ struct RefreshRequest<'a> {
refresh_token: &'a str,
}

#[cfg(any(target_os = "linux", target_os = "macos"))]
#[cfg(target_family = "unix")]
fn config_dir() -> Result<PathBuf, Error> {
let mut home = home::home_dir().ok_or(Error::Str("home directory not found"))?;
home.push(CONFIG_DIR);
Ok(home)
}

#[cfg(target_os = "windows")]
#[cfg(target_family = "windows")]
fn config_dir() -> Result<PathBuf, Error> {
let app_data = std::env::var(ENV_APPDATA)
.map_err(|_| Error::Str("APPDATA environment variable not found"))?;
Expand All @@ -129,8 +129,8 @@ fn config_dir() -> Result<PathBuf, Error> {
const DEFAULT_TOKEN_GCP_URI: &str = "https://accounts.google.com/o/oauth2/token";
const USER_CREDENTIALS_PATH: &str = "gcloud/application_default_credentials.json";

#[cfg(any(target_os = "linux", target_os = "macos"))]
#[cfg(target_family = "unix")]
const CONFIG_DIR: &str = ".config";

#[cfg(target_os = "windows")]
#[cfg(target_family = "windows")]
const ENV_APPDATA: &str = "APPDATA";
4 changes: 2 additions & 2 deletions src/gcloud_authorized_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ fn run(cmd: &[&str]) -> Result<String, Error> {
String::from_utf8(stdout).map_err(|_| Error::Str("output from `gcloud` is not UTF-8"))
}

#[cfg(any(target_os = "linux", target_os = "macos"))]
#[cfg(target_family = "unix")]
const GCLOUD_CMD: &str = "gcloud";

#[cfg(target_os = "windows")]
#[cfg(target_family = "windows")]
const GCLOUD_CMD: &str = "gcloud.cmd";

/// The default number of seconds that it takes for a Google Cloud auth token to expire.
Expand Down
Loading