From 09bc8d654b935de6728b7cfaf6a3734408b8f515 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 28 Nov 2023 22:07:44 +1100 Subject: [PATCH 1/2] Attempt to fix configurator. --- lib/python/qmk/userspace.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/python/qmk/userspace.py b/lib/python/qmk/userspace.py index 378356800699..515e510b2a85 100644 --- a/lib/python/qmk/userspace.py +++ b/lib/python/qmk/userspace.py @@ -15,11 +15,12 @@ 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 'ORIG_CWD' in environ: + 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: From 211913be4c2bdbb3993b1bfc375ea5480bdf2751 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 28 Nov 2023 22:14:15 +1100 Subject: [PATCH 2/2] Consistency. --- lib/python/qmk/userspace.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/python/qmk/userspace.py b/lib/python/qmk/userspace.py index 515e510b2a85..103f11b99aba 100644 --- a/lib/python/qmk/userspace.py +++ b/lib/python/qmk/userspace.py @@ -15,7 +15,7 @@ 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 - if 'ORIG_CWD' in environ: + 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(): @@ -24,7 +24,7 @@ def qmk_userspace_paths(): # 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)