File tree 1 file changed +12
-8
lines changed
1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,18 @@ pub fn main_inner(profile: Profile) {
22
22
let tempdir = TempDir :: new ( ) . expect ( "temp dir" ) ;
23
23
let current_dir = current_dir ( ) . expect ( "current dir" ) ;
24
24
let current_dir = current_dir. to_str ( ) . expect ( "current dir" ) . to_string ( ) ;
25
- let toml = Toml :: parse ( include_str ! ( "../config.toml" ) ) . expect ( "Failed to parse `config.toml`" ) ;
26
- let gcc_path = if let Ok ( gcc_path) = toml. get_string ( "gcc-path" ) {
27
- PathBuf :: from ( gcc_path. to_string ( ) )
28
- } else {
29
- // then we try to retrieve it from the `target` folder.
30
- let commit = include_str ! ( "../libgccjit.version" ) . trim ( ) ;
31
- Path :: new ( "build/libgccjit" ) . join ( commit)
32
- } ;
25
+
26
+ let gcc_path = std:: fs:: read_to_string ( "../config.toml" )
27
+ . ok ( )
28
+ . and_then ( |v| {
29
+ let toml = Toml :: parse ( & v) . expect ( "Failed to parse `config.toml`" ) ;
30
+ toml. get_string ( "gcc-path" ) . map ( PathBuf :: from) . ok ( )
31
+ } )
32
+ . unwrap_or_else ( || {
33
+ // then we try to retrieve it from the `target` folder.
34
+ let commit = include_str ! ( "../libgccjit.version" ) . trim ( ) ;
35
+ Path :: new ( "build/libgccjit" ) . join ( commit)
36
+ } ) ;
33
37
34
38
let gcc_path = Path :: new ( & gcc_path)
35
39
. canonicalize ( )
You can’t perform that action at this time.
0 commit comments