Core: Assert that if an apworld manifest file exists, it has a game field (#5478)
* Assert that if an apworld manifest file exists, it has a game field * god damnit * Update worlds/LauncherComponents.py Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com> * Update setup.py Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com> --------- Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
This commit is contained in:
9
setup.py
9
setup.py
@@ -383,6 +383,15 @@ class BuildExeCommand(cx_Freeze.command.build_exe.build_exe):
|
|||||||
world_directory = self.libfolder / "worlds" / file_name
|
world_directory = self.libfolder / "worlds" / file_name
|
||||||
if os.path.isfile(world_directory / "archipelago.json"):
|
if os.path.isfile(world_directory / "archipelago.json"):
|
||||||
manifest = json.load(open(world_directory / "archipelago.json"))
|
manifest = json.load(open(world_directory / "archipelago.json"))
|
||||||
|
|
||||||
|
assert "game" in manifest, (
|
||||||
|
f"World directory {world_directory} has an archipelago.json manifest file, but it"
|
||||||
|
"does not define a \"game\"."
|
||||||
|
)
|
||||||
|
assert manifest["game"] == worldtype.game, (
|
||||||
|
f"World directory {world_directory} has an archipelago.json manifest file, but value of the"
|
||||||
|
f"\"game\" field ({manifest['game']} does not equal the World class's game ({worldtype.game})."
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
manifest = {}
|
manifest = {}
|
||||||
# this method creates an apworld that cannot be moved to a different OS or minor python version,
|
# this method creates an apworld that cannot be moved to a different OS or minor python version,
|
||||||
|
|||||||
@@ -274,6 +274,15 @@ if not is_frozen():
|
|||||||
world_directory = os.path.join("worlds", file_name)
|
world_directory = os.path.join("worlds", file_name)
|
||||||
if os.path.isfile(os.path.join(world_directory, "archipelago.json")):
|
if os.path.isfile(os.path.join(world_directory, "archipelago.json")):
|
||||||
manifest = json.load(open(os.path.join(world_directory, "archipelago.json")))
|
manifest = json.load(open(os.path.join(world_directory, "archipelago.json")))
|
||||||
|
|
||||||
|
assert "game" in manifest, (
|
||||||
|
f"World directory {world_directory} has an archipelago.json manifest file, but it"
|
||||||
|
"does not define a \"game\"."
|
||||||
|
)
|
||||||
|
assert manifest["game"] == worldtype.game, (
|
||||||
|
f"World directory {world_directory} has an archipelago.json manifest file, but value of the"
|
||||||
|
f"\"game\" field ({manifest['game']} does not equal the World class's game ({worldtype.game})."
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
manifest = {}
|
manifest = {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user