Skip to content

Commit 8641923

Browse files
Update src/utils.rs
Co-authored-by: Rene Leonhardt <[email protected]>
1 parent d047d76 commit 8641923

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/utils.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ pub(crate) fn get_home_dir() -> Option<String> {
66
// This function is required when `glob_tilde_expansion` field of `glob::MatchOptions` is
77
// set `true` and pattern starts with `~` followed by any char expect `/`
88
pub(crate) fn get_user_name() -> Option<String> {
9-
if cfg!(target_os = "linux") {
10-
std::env::var("USER").ok()
11-
} else {
12-
None
13-
}
9+
#[cfg(not(target_os = "windows"))]
10+
return std::env::var("USER").ok();
11+
#[cfg(target_os = "windows")]
12+
std::env::var("USERNAME").ok()
1413
}

0 commit comments

Comments
 (0)