Skip to content

Commit

Permalink
Dedup the list of tested userspace paths. (#22599)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarc authored Dec 2, 2023
1 parent b68e89f commit 01eed8d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/python/qmk/userspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@


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 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)
test_dirs[current_dir] = True
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['QMK_USERSPACE'])
if current_dir.is_dir():
test_dirs.append(current_dir)
test_dirs[current_dir] = True

# If someone has configured a directory, use that
if cli.config.user.overlay_dir is not None:
current_dir = Path(cli.config.user.overlay_dir)
if current_dir.is_dir():
test_dirs.append(current_dir)
test_dirs[current_dir] = True

return test_dirs
return list(test_dirs.keys())


def qmk_userspace_validate(path):
Expand Down

0 comments on commit 01eed8d

Please sign in to comment.