Skip to content

Commit f7e49a4

Browse files
svenski123djc
authored andcommitted
add support for freebsd by generalising conditional compilation from target_os to target_family
1 parent 565ebc6 commit f7e49a4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/config_default_credentials.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ struct RefreshRequest<'a> {
108108
refresh_token: &'a str,
109109
}
110110

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

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

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

135-
#[cfg(target_os = "windows")]
135+
#[cfg(target_family = "windows")]
136136
const ENV_APPDATA: &str = "APPDATA";

src/gcloud_authorized_user.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ fn run(cmd: &[&str]) -> Result<String, Error> {
7575
String::from_utf8(stdout).map_err(|_| Error::Str("output from `gcloud` is not UTF-8"))
7676
}
7777

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

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

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

0 commit comments

Comments
 (0)