fix: return empty list if mod dir is missing

This commit is contained in:
aclist committed 2026-11-19 06:22:05 +09:00
1 parent 29223a8a1f
commit 5853e15b8e
2 files changed
+6

No files matched your search

+4
View File
@@ -35,6 +35,9 @@ def get_local_mod_path(steam_path: Path) -> Path:
def get_local_mods(workshop_path: Path) -> list[Path]:
# NOTE: user may not have staged mods before
if workshop_path.is_dir() is False:
return []
mods = [file for file in workshop_path.iterdir() if file.is_dir()]
return mods
@@ -123,6 +126,7 @@ def remove_stale_signatures(
path = lookup(config, Preferences.DEFAULT)
steam_path = Path(path)
if ids is None:
local_ids = get_local_mod_ids(steam_path)
+2
View File
@@ -35,6 +35,8 @@ def rebuild_symlinks(config: Path) -> None:
expunge_link(file)
workshop = get_local_mod_path(steam_path)
if workshop.is_dir() is False:
return
# NOTE: create symlinks for missing mods
for mod_id in get_local_mod_ids(steam_path):
uid = str(mod_id)