Skip to content

Commit fc63885

Browse files
committed
Dont use best partial match for category and developer when selecting exe + BUILD
1 parent e022425 commit fc63885

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

modules/callbacks.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def update_start_with_system(toggle: bool):
8585
)
8686

8787

88-
def _fuzzy_match_subdir(where: pathlib.Path, match: str):
88+
def _fuzzy_match_subdir(where: pathlib.Path, match: str, best_partial_match: bool):
8989
clean_charset = string.ascii_letters + string.digits + " "
9090
clean_dir = "".join(char for char in match.replace("&", "and") if char in clean_charset)
9191
clean_dir = re.sub(r" +", r" ", clean_dir).strip()
@@ -95,7 +95,10 @@ def _fuzzy_match_subdir(where: pathlib.Path, match: str):
9595
try:
9696
dirs = [node.name for node in where.iterdir() if node.is_dir()]
9797
clean_dir_lower = clean_dir.lower()
98-
match_dirs = [d for d in dirs if clean_dir_lower in d.lower()]
98+
if best_partial_match:
99+
match_dirs = [d for d in dirs if clean_dir_lower in d.lower()]
100+
else:
101+
match_dirs = []
99102
if len(match_dirs) == 1:
100103
where /= match_dirs[0]
101104
else:
@@ -136,11 +139,11 @@ def popup_content():
136139
start_dir = globals.settings.default_exe_dir.get(globals.os)
137140
if start_dir:
138141
start_dir = pathlib.Path(start_dir)
139-
try_subdirs = [game.type.name, game.developer, game.name]
142+
try_subdirs = [(game.type.name, False), (game.developer, False), (game.name, True)]
140143
if game.name.lower().endswith(" collection"):
141-
try_subdirs.append(game.name[:-len(" collection")])
142-
for subdir in try_subdirs:
143-
start_dir = _fuzzy_match_subdir(start_dir, subdir)
144+
try_subdirs.append((game.name[:-len(" collection")], True))
145+
for subdir, best_partial_match in try_subdirs:
146+
start_dir = _fuzzy_match_subdir(start_dir, subdir, best_partial_match)
144147
utils.push_popup(filepicker.FilePicker(
145148
title=f"Select or drop executable for {game.name}",
146149
start_dir=start_dir,

0 commit comments

Comments
 (0)