Attempt to fix configurator. (#22555)

This commit is contained in:
Nick Brassel 2023-11-29 01:07:21 +11:00 committed by GitHub
parent 0115951de1
commit 049e964e61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,15 +15,16 @@ def qmk_userspace_paths():
test_dirs = [] test_dirs = []
# If we're already in a directory with a qmk.json and a keyboards or layouts directory, interpret it as userspace # If we're already in a directory with a qmk.json and a keyboards or layouts directory, interpret it as userspace
current_dir = Path(environ['ORIG_CWD']) if environ.get('ORIG_CWD') is not None:
while len(current_dir.parts) > 1: current_dir = Path(environ['ORIG_CWD'])
if (current_dir / 'qmk.json').is_file(): while len(current_dir.parts) > 1:
test_dirs.append(current_dir) if (current_dir / 'qmk.json').is_file():
current_dir = current_dir.parent test_dirs.append(current_dir)
current_dir = current_dir.parent
# If we have a QMK_USERSPACE environment variable, use that # If we have a QMK_USERSPACE environment variable, use that
if environ.get('QMK_USERSPACE') is not None: if environ.get('QMK_USERSPACE') is not None:
current_dir = Path(environ.get('QMK_USERSPACE')) current_dir = Path(environ['QMK_USERSPACE'])
if current_dir.is_dir(): if current_dir.is_dir():
test_dirs.append(current_dir) test_dirs.append(current_dir)