File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 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) {
2222 let tempdir = TempDir :: new ( ) . expect ( "temp dir" ) ;
2323 let current_dir = current_dir ( ) . expect ( "current dir" ) ;
2424 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+ } ) ;
3337
3438 let gcc_path = Path :: new ( & gcc_path)
3539 . canonicalize ( )
You can’t perform that action at this time.
0 commit comments