QModListModel: get game path with GameFinder

This commit is contained in:
Toast 2025-06-02 01:24:52 +02:00
parent 67edfdf743
commit f2cc48f705

View file

@ -3,16 +3,11 @@ from PySide6.QtCore import QAbstractListModel, QModelIndex
from leek.mod import InvalidModError from leek.mod import InvalidModError
from leek.qmod import QMod from leek.qmod import QMod
from pathlib import Path from pathlib import Path
from leek.utils import GameFinder
QML_IMPORT_NAME = "Leek" QML_IMPORT_NAME = "Leek"
QML_IMPORT_MAJOR_VERSION = 1 QML_IMPORT_MAJOR_VERSION = 1
# TODO: Don't harcode the mods path
GAME_PATH = Path(
"/home/toast/.local/share/Steam/steamapps/common/Hatsune Miku Project DIVA Mega Mix Plus/"
)
MOD_PATH = Path(GAME_PATH, "mods")
# Qt follows C++ naming conventions # Qt follows C++ naming conventions
# ruff: noqa: N802 # ruff: noqa: N802
@ -22,7 +17,9 @@ class QModListModel(QAbstractListModel):
super().__init__(parent=parent) super().__init__(parent=parent)
mods: list[QMod] = [] mods: list[QMod] = []
for dir in MOD_PATH.iterdir(): mod_path: Path = GameFinder.find() / "mods"
for dir in mod_path.iterdir():
if dir.name == ".stfolder": if dir.name == ".stfolder":
continue continue
try: try: