From 63a3fc3591f755d1ef6b36269e61df16f4c32707 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Fri, 13 Feb 2026 18:21:51 +0000 Subject: Fix `qmk flash` handling of paths relative to qmk_firmware (#25993) --- lib/python/qmk/path.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/python/qmk/path.py b/lib/python/qmk/path.py index 1739689adf..3b8bafbd4e 100644 --- a/lib/python/qmk/path.py +++ b/lib/python/qmk/path.py @@ -177,5 +177,17 @@ class FileType(argparse.FileType): """normalize and check exists otherwise magic strings like '-' for stdin resolve to bad paths """ + # TODO: This should not return both Path and TextIOWrapper as consumers + # assume that they can call Path.as_posix without checking type + + # Handle absolute paths and relative paths to CWD norm = normpath(string) - return norm if norm.exists() else super().__call__(string) + if norm.exists(): + return norm + + # Handle relative paths to QMK_HOME + relative = Path(string) + if relative.exists(): + return relative + + return super().__call__(string) -- cgit v1.2.3