Fix qmk flash handling of paths relative to qmk_firmware
This commit is contained in:
parent
6729379041
commit
a3cd83aee0
1 changed files with 13 additions and 1 deletions
|
|
@ -177,5 +177,17 @@ class FileType(argparse.FileType):
|
||||||
"""normalize and check exists
|
"""normalize and check exists
|
||||||
otherwise magic strings like '-' for stdin resolve to bad paths
|
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)
|
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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue