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.
pull/4669/head
Will Miles 2025-05-22 09:13:54 -04:00
rodzic 7ea510e75b
commit 792a7aa081
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -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