File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -16,17 +16,26 @@ struct Platform {
16
16
17
17
const CONFIG_FILE : & str = "framework_tool_config.toml" ;
18
18
19
- pub fn load_config ( ) -> Option < util:: Platform > {
19
+ #[ cfg( feature = "uefi" ) ]
20
+ fn read_config_file ( ) -> String {
21
+ crate :: uefi:: fs:: shell_read_file ( CONFIG_FILE )
22
+ }
23
+ #[ cfg( not( feature = "uefi" ) ) ]
24
+ fn read_config_file ( ) -> String {
20
25
let mut path = std:: env:: current_exe ( ) . unwrap ( ) ;
21
26
path. pop ( ) ;
22
27
path. push ( CONFIG_FILE ) ;
23
28
24
- let toml_str = if let Ok ( str) = std:: fs:: read_to_string ( path) {
29
+ if let Ok ( str) = std:: fs:: read_to_string ( path) {
25
30
str
26
31
} else {
27
32
path = CONFIG_FILE . into ( ) ;
28
33
std:: fs:: read_to_string ( path) . unwrap ( )
29
- } ;
34
+ }
35
+ }
36
+
37
+ pub fn load_config ( ) -> Option < util:: Platform > {
38
+ let toml_str = read_config_file ( ) ;
30
39
31
40
let decoded: Config = toml:: from_str ( & toml_str) . unwrap ( ) ;
32
41
println ! ( "{:?}" , decoded) ;
You can’t perform that action at this time.
0 commit comments