@@ -1552,27 +1552,33 @@ impl Config {
1552
1552
toml. profile = Some ( "dist" . into ( ) ) ;
1553
1553
}
1554
1554
1555
- if let Some ( include) = & toml. profile {
1556
- // Allows creating alias for profile names, allowing
1557
- // profiles to be renamed while maintaining back compatibility
1558
- // Keep in sync with `profile_aliases` in bootstrap.py
1559
- let profile_aliases = HashMap :: from ( [ ( "user" , "dist" ) ] ) ;
1560
- let include = match profile_aliases. get ( include. as_str ( ) ) {
1561
- Some ( alias) => alias,
1562
- None => include. as_str ( ) ,
1563
- } ;
1564
- let mut include_path = config. src . clone ( ) ;
1565
- include_path. push ( "src" ) ;
1566
- include_path. push ( "bootstrap" ) ;
1567
- include_path. push ( "defaults" ) ;
1568
- include_path. push ( format ! ( "bootstrap.{include}.toml" ) ) ;
1555
+ if let Some ( profile) = & toml. profile {
1556
+ let mut include_path = PathBuf :: from ( format ! ( "{profile}.toml" ) ) ;
1557
+
1558
+ if !include_path. exists ( ) {
1559
+ // Allows creating alias for profile names, allowing
1560
+ // profiles to be renamed while maintaining back compatibility
1561
+ // Keep in sync with `profile_aliases` in bootstrap.py
1562
+ let profile_aliases = HashMap :: from ( [ ( "user" , "dist" ) ] ) ;
1563
+ let profile = match profile_aliases. get ( profile. as_str ( ) ) {
1564
+ Some ( alias) => alias,
1565
+ None => profile. as_str ( ) ,
1566
+ } ;
1567
+
1568
+ include_path = config
1569
+ . src
1570
+ . join ( "src/bootstrap/defaults" )
1571
+ . join ( format ! ( "bootstrap.{profile}.toml" ) ) ;
1572
+ }
1573
+
1569
1574
let included_toml = get_toml ( & include_path) . unwrap_or_else ( |e| {
1570
1575
eprintln ! (
1571
1576
"ERROR: Failed to parse default config profile at '{}': {e}" ,
1572
1577
include_path. display( )
1573
1578
) ;
1574
1579
exit ! ( 2 ) ;
1575
1580
} ) ;
1581
+
1576
1582
toml. merge ( included_toml, ReplaceOpt :: IgnoreDuplicate ) ;
1577
1583
}
1578
1584
0 commit comments