Replace DIRECTORY_NOT_FOUND errors with exceptions.

We didn't have handing, so this was an "unknown error". I'll borrow the handling from easyrpg so you can get a better message here.
This commit is contained in:
Daniel Johnson 2023-12-27 18:22:33 -05:00
parent 21694376ce
commit bc902394b0

View file

@ -1,6 +1,7 @@
# Standard Library
from gettext import gettext as _
from lutris.exceptions import DirectoryNotFoundError
# Lutris Modules
from lutris.runners.runner import Runner
from lutris.util import system
@ -64,7 +65,7 @@ class cemu(Runner):
mlc = self.runner_config.get("mlc")
if mlc:
if not system.path_exists(mlc):
return {"error": "DIRECTORY_NOT_FOUND", "directory": mlc}
raise DirectoryNotFoundError(directory=mlc)
arguments += ["-m", mlc]
ud = self.runner_config.get("ud")
if ud:
@ -77,6 +78,6 @@ class cemu(Runner):
arguments.append("--legacy")
gamedir = self.game_config.get("main_file") or ""
if not system.path_exists(gamedir):
return {"error": "DIRECTORY NOT FOUND", "directory": gamedir}
raise DirectoryNotFoundError(directory=gamedir)
arguments += ["-g", gamedir]
return {"command": arguments}