Skip to content

Commit

Permalink
Use env::home_dir() instead of env::var_os(HOME).
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntSushi committed Nov 17, 2016
1 parent 39e1a0d commit a3f5e0c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ignore/src/gitignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ fn gitconfig_contents() -> Option<Vec<u8>> {
/// Specifically, this respects XDG_CONFIG_HOME.
fn excludes_file_default() -> Option<PathBuf> {
env::var_os("XDG_CONFIG_HOME")
.and_then(|x| if x.is_empty() { None } else { Some(x) })
.or_else(|| env::var_os("HOME"))
.map(|x| PathBuf::from(x).join("git/ignore"))
.and_then(|x| if x.is_empty() { None } else { Some(PathBuf::from(x)) })
.or_else(|| env::home_dir())
.map(|x| x.join("git/ignore"))
}

/// Extract git's `core.excludesfile` config setting from the raw file contents
Expand Down

1 comment on commit a3f5e0c

@steveklabnik
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Please sign in to comment.