Files
platformio-core/tests
josh a8ff6feacc Fix: relative -d/--project-dir path causes FileNotFoundError in device monitor (#5470)
Fix: resolve relative -d/--project-dir path in `pio device monitor`

`device_monitor_cmd`'s `-d/--project-dir` option accepted a relative path
without resolving it to absolute. The command then entered
`with fs.cd(options["project_dir"]):`, changing the working directory into
that relative subdir. Downstream, a platform monitor filter (e.g. the
espressif32 exception decoder) re-enters the same still-relative
`project_dir` via `load_build_metadata()`'s own `fs.cd()`, duplicating the
path segment onto the already-changed cwd and crashing with
FileNotFoundError (platformio/platformio-core#5439).

Add `resolve_path=True` to the click.Path type so the path is resolved to
absolute once, at the point it enters the system, before any fs.cd() chain
runs. This does not change the no-flag default (os.getcwd already returns
absolute) or the already-absolute case (passes through unchanged, modulo
symlink resolution).

Add a regression test mirroring the nested fs.cd() scenario, plus coverage
for the default and already-absolute cases.
2026-07-08 12:18:29 +03:00
..
2023-06-05 18:15:30 +03:00
2026-03-26 17:01:53 +02:00
2026-02-02 14:08:44 +02:00
2020-08-17 12:56:57 +03:00