File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -45,18 +45,20 @@ const CLIENT_CONFIG_FILE_NAME: &str = "miden-client.toml";
45
45
/// name, then we simply display the standard "miden-client".
46
46
pub fn client_binary_name ( ) -> OsString {
47
47
std:: env:: current_exe ( )
48
- . map ( |executable| {
49
- executable
50
- . file_name ( )
51
- . expect ( "ERROR: failed to obtain the executable's file name" )
52
- . to_os_string ( )
53
- } )
54
48
. inspect_err ( |e| {
55
49
eprintln ! (
56
- "WARNING: Couldn't obtain the name of the current executable because of {e}.\
50
+ "WARNING: Couldn't obtain the path of the current executable because of {e}.\
57
51
Defaulting to miden-client."
58
52
) ;
59
53
} )
54
+ . and_then ( |executable_path| {
55
+ executable_path. file_name ( ) . and_then ( |name| Some ( name. to_os_string ( ) ) ) . ok_or (
56
+ std:: io:: Error :: new (
57
+ std:: io:: ErrorKind :: Other ,
58
+ "Couldn't obtain the file name of the current executable" ,
59
+ ) ,
60
+ )
61
+ } )
60
62
. unwrap_or ( OsString :: from ( "miden-client" ) )
61
63
}
62
64
You can’t perform that action at this time.
0 commit comments