commit a2c745cae888eedf327294fa3a1aa518f91a77c0 parent 2450fe28ee00a816be02fc770cceae8deb2b2f1d Author: QMK Bot <hello@qmk.fm> Date: Tue, 28 Nov 2023 14:07:50 +0000 Merge remote-tracking branch 'origin/master' into develop Diffstat:
| M | lib/python/qmk/userspace.py | | | 13 | +++++++------ |
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/python/qmk/userspace.py b/lib/python/qmk/userspace.py @@ -15,15 +15,16 @@ def qmk_userspace_paths(): test_dirs = [] # 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']) - while len(current_dir.parts) > 1: - if (current_dir / 'qmk.json').is_file(): - test_dirs.append(current_dir) - current_dir = current_dir.parent + if environ.get('ORIG_CWD') is not None: + current_dir = Path(environ['ORIG_CWD']) + while len(current_dir.parts) > 1: + if (current_dir / 'qmk.json').is_file(): + test_dirs.append(current_dir) + current_dir = current_dir.parent # If we have a QMK_USERSPACE environment variable, use that 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(): test_dirs.append(current_dir)