diff options
author | Joel Challis <git@zvecr.com> | 2024-03-13 00:28:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 00:28:08 +0000 |
commit | fb11330eab2b459d5e510c66a9bdf3961c8e639a (patch) | |
tree | 99254e3c544a0633ea95cf8281270609e7fd2eaa | |
parent | 6788a5eb27b1db5d25ef6388bb8b698899de2f9e (diff) |
Absolute paths for -kb argument should error consistently (#23262)
-rw-r--r-- | lib/python/qmk/path.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/python/qmk/path.py b/lib/python/qmk/path.py index 74364ee04b..bb588d2e1c 100644 --- a/lib/python/qmk/path.py +++ b/lib/python/qmk/path.py @@ -12,11 +12,19 @@ from qmk.errors import NoSuchKeyboardError def is_keyboard(keyboard_name): """Returns True if `keyboard_name` is a keyboard we can compile. """ - if keyboard_name: - keyboard_path = QMK_FIRMWARE / 'keyboards' / keyboard_name - rules_mk = keyboard_path / 'rules.mk' + if not keyboard_name: + return False + + # keyboard_name values of 'c:/something' or '/something' trigger append issues + # due to "If the argument is an absolute path, the previous path is ignored" + # however it should always be a folder located under qmk_firmware/keyboards + if Path(keyboard_name).is_absolute(): + return False + + keyboard_path = QMK_FIRMWARE / 'keyboards' / keyboard_name + rules_mk = keyboard_path / 'rules.mk' - return rules_mk.exists() + return rules_mk.exists() def under_qmk_firmware(path=Path(os.environ['ORIG_CWD'])): |