@@ -1552,27 +1552,33 @@ impl Config {
15521552 toml. profile = Some ( "dist" . into ( ) ) ;
15531553 }
15541554
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+
15691574 let included_toml = get_toml ( & include_path) . unwrap_or_else ( |e| {
15701575 eprintln ! (
15711576 "ERROR: Failed to parse default config profile at '{}': {e}" ,
15721577 include_path. display( )
15731578 ) ;
15741579 exit ! ( 2 ) ;
15751580 } ) ;
1581+
15761582 toml. merge ( included_toml, ReplaceOpt :: IgnoreDuplicate ) ;
15771583 }
15781584
0 commit comments