File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -617,7 +617,7 @@ impl Error for JoinPathsError {
617
617
/// # Unix
618
618
///
619
619
/// - Returns the value of the 'HOME' environment variable if it is set
620
- /// (including to an empty string).
620
+ /// (and not an empty string).
621
621
/// - Otherwise, it tries to determine the home directory by invoking the `getpwuid_r` function
622
622
/// using the UID of the current user. An empty home directory field returned from the
623
623
/// `getpwuid_r` function is considered to be a valid value.
Original file line number Diff line number Diff line change @@ -633,7 +633,10 @@ pub fn temp_dir() -> PathBuf {
633
633
}
634
634
635
635
pub fn home_dir ( ) -> Option < PathBuf > {
636
- return crate :: env:: var_os ( "HOME" ) . or_else ( || unsafe { fallback ( ) } ) . map ( PathBuf :: from) ;
636
+ return crate :: env:: var_os ( "HOME" )
637
+ . filter ( |s| !s. is_empty ( ) )
638
+ . or_else ( || unsafe { fallback ( ) } )
639
+ . map ( PathBuf :: from) ;
637
640
638
641
#[ cfg( any(
639
642
target_os = "android" ,
You can’t perform that action at this time.
0 commit comments