File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -17,25 +17,25 @@ struct Platform {
1717const CONFIG_FILE : & str = "framework_tool_config.toml" ;
1818
1919#[ cfg( feature = "uefi" ) ]
20- fn read_config_file ( ) -> String {
21- crate :: uefi:: fs:: shell_read_file ( CONFIG_FILE )
20+ fn read_config_file ( ) -> Option < String > {
21+ Some ( crate :: uefi:: fs:: shell_read_file ( CONFIG_FILE ) )
2222}
2323#[ cfg( not( feature = "uefi" ) ) ]
24- fn read_config_file ( ) -> String {
25- let mut path = std:: env:: current_exe ( ) . unwrap ( ) ;
24+ fn read_config_file ( ) -> Option < String > {
25+ let mut path = std:: env:: current_exe ( ) . ok ( ) ? ;
2626 path. pop ( ) ;
2727 path. push ( CONFIG_FILE ) ;
2828
2929 if let Ok ( str) = std:: fs:: read_to_string ( path) {
30- str
30+ Some ( str)
3131 } else {
3232 path = CONFIG_FILE . into ( ) ;
33- std:: fs:: read_to_string ( path) . unwrap ( )
33+ Some ( std:: fs:: read_to_string ( path) . ok ( ) ? )
3434 }
3535}
3636
3737pub fn load_config ( ) -> Option < util:: Platform > {
38- let toml_str = read_config_file ( ) ;
38+ let toml_str = read_config_file ( ) ? ;
3939
4040 let decoded: Config = toml:: from_str ( & toml_str) . unwrap ( ) ;
4141 println ! ( "{:?}" , decoded) ;
You can’t perform that action at this time.
0 commit comments