From cb0706f9cc4bfb64148cc20188e831af71a51c31 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 2 Oct 2025 13:43:42 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Fix=20misplaced=20config=20files?= =?UTF-8?q?=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #28091 --- .../PlatformIO/scripts/preflight-checks.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 80f0985cfd..11f4b2b886 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -65,13 +65,14 @@ if pioutil.is_pio_build(): # Useful values project_dir = Path(env['PROJECT_DIR']) config_files = ("Configuration.h", "Configuration_adv.h") + mpath = project_dir / "Marlin" # # Update old macros BOTH and EITHER in configuration files # conf_modified = False for f in config_files: - conf_path = project_dir / "Marlin" / f + conf_path = mpath / f if conf_path.is_file(): with open(conf_path, 'r', encoding="utf8") as file: text = file.read() @@ -101,13 +102,16 @@ if pioutil.is_pio_build(): raise SystemExit(err) # - # Check for Config files in two common incorrect places + # Check for Config files *only* existing in common incorrect places # - for p in (project_dir, project_dir / "config"): - for f in config_files: - if (p / f).is_file(): - err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p - raise SystemExit(err) + if (mpath / "Config.h").is_file() or ((mpath / config_files[0]).is_file() and (mpath / config_files[1]).is_file()): + pass + else: + for p in (project_dir, project_dir / "config"): + for f in config_files: + if (p / f).is_file(): + err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p + raise SystemExit(err) # # Find the name.cpp.o or name.o and remove it