From 792a7aa0815be4fc3a8e7779f5d0d93a49d3cc51 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Thu, 22 May 2025 09:13:54 -0400 Subject: [PATCH] load_usermods: Resolve folder paths Ensure all paths used in usermod symlinks are fully resolved, including any case correctness issues on Windows. Apparently PlatformIO does not handle symlink files correctly on Windows if there are case differences between cwd and the resolved path. --- pio-scripts/load_usermods.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pio-scripts/load_usermods.py b/pio-scripts/load_usermods.py index 8cf625ff6..4e0457a0c 100644 --- a/pio-scripts/load_usermods.py +++ b/pio-scripts/load_usermods.py @@ -7,7 +7,7 @@ from SCons.Script import Exit from platformio.builder.tools.piolib import LibBuilderBase from platformio.package.manager.library import LibraryPackageManager -usermod_dir = Path(env["PROJECT_DIR"]) / "usermods" +usermod_dir = Path(env["PROJECT_DIR"]).resolve() / "usermods" # "usermods" environment: expand list of usermods to everything in the folder if env['PIOENV'] == "usermods": @@ -48,7 +48,7 @@ if usermods: src_dir = proj.get("platformio", "src_dir") src_dir = src_dir.replace('\\','/') mod_paths = {mod: find_usermod(mod) for mod in usermods.split()} - usermods = [f"{mod} = symlink://{path}" for mod, path in mod_paths.items()] + usermods = [f"{mod} = symlink://{path.resolve()}" for mod, path in mod_paths.items()] proj.set("env:" + env['PIOENV'], 'lib_deps', deps + usermods) # Force usermods to be installed in to the environment build state before the LDF runs # Otherwise we won't be able to see them until it's too late to change their paths for LDF