File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " fnm " : patch
3+ ---
4+
5+ Allow reading non-unicode paths from environment variables
Original file line number Diff line number Diff line change @@ -185,18 +185,20 @@ fn warn_if_multishell_path_not_in_path_env_var(
185185 multishell_path : & std:: path:: Path ,
186186 config : & FnmConfig ,
187187) {
188- let bin_path = if cfg ! ( unix) {
189- multishell_path. join ( "bin" )
190- } else {
191- multishell_path. to_path_buf ( )
192- } ;
193-
194- let fixed_path = bin_path. to_str ( ) . and_then ( shell:: maybe_fix_windows_path) ;
195- let fixed_path = fixed_path. as_ref ( ) . map ( |x| & x[ ..] ) ;
196-
197- for path in std:: env:: split_paths ( & std:: env:: var ( "PATH" ) . unwrap_or_default ( ) ) {
198- if bin_path == path || fixed_path == path. to_str ( ) {
199- return ;
188+ if let Some ( path_var) = std:: env:: var_os ( "PATH" ) {
189+ let bin_path = if cfg ! ( unix) {
190+ multishell_path. join ( "bin" )
191+ } else {
192+ multishell_path. to_path_buf ( )
193+ } ;
194+
195+ let fixed_path = bin_path. to_str ( ) . and_then ( shell:: maybe_fix_windows_path) ;
196+ let fixed_path = fixed_path. as_deref ( ) ;
197+
198+ for path in std:: env:: split_paths ( & path_var) {
199+ if bin_path == path || fixed_path == path. to_str ( ) {
200+ return ;
201+ }
200202 }
201203 }
202204
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use crate::path_ext::PathExt;
55
66fn xdg_dir ( env : & str ) -> Option < PathBuf > {
77 if cfg ! ( windows) {
8- let env_var = std:: env:: var ( env) . ok ( ) ?;
8+ let env_var = std:: env:: var_os ( env) ?;
99 Some ( PathBuf :: from ( env_var) )
1010 } else {
1111 // On non-Windows platforms, `etcetera` already handles XDG variables
You can’t perform that action at this time.
0 commit comments