Skip to content

Commit

Permalink
Absolute paths for -kb argument should error consistently (qmk#23262)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Mar 13, 2024
1 parent 6788a5e commit fb11330
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/python/qmk/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@
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'])):
Expand Down

0 comments on commit fb11330

Please sign in to comment.