Skip to content

Commit 13d4c61

Browse files
committed
Place config.toml in current working directory if config not found
1 parent 371100b commit 13d4c61

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/bootstrap/bin/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn main() {
3535

3636
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
3737
// changelog warning, not the `x.py setup` message.
38-
let suggest_setup = !config.config.exists() && !matches!(config.cmd, Subcommand::Setup { .. });
38+
let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. });
3939
if suggest_setup {
4040
println!("warning: you have not made a `config.toml`");
4141
println!(

src/bootstrap/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub struct Config {
8080
pub keep_stage_std: Vec<u32>,
8181
pub src: PathBuf,
8282
/// defaults to `config.toml`
83-
pub config: PathBuf,
83+
pub config: Option<PathBuf>,
8484
pub jobs: Option<u32>,
8585
pub cmd: Subcommand,
8686
pub incremental: bool,
@@ -942,7 +942,7 @@ impl Config {
942942
}
943943

944944
config.changelog_seen = toml.changelog_seen;
945-
config.config = toml_path;
945+
config.config = if toml_path.exists() { Some(toml_path) } else { None };
946946

947947
let build = toml.build.unwrap_or_default();
948948

src/bootstrap/setup.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl fmt::Display for Profile {
8282
}
8383

8484
pub fn setup(config: &Config, profile: Profile) {
85-
let path = &config.config;
85+
let path = &config.config.clone().unwrap_or(PathBuf::from("config.toml"));
8686

8787
if path.exists() {
8888
eprintln!(

0 commit comments

Comments
 (0)