Core: Use Better Practices Accessing Manifests (#5543)

* Close manifest files

* Name explicit encoding
This commit is contained in:
Nicholas Saylor
2025-10-14 19:09:05 -04:00
committed by GitHub
parent bdae7cd42c
commit 28c7a214dc
3 changed files with 6 additions and 3 deletions

View File

@@ -271,7 +271,8 @@ if not is_frozen():
file_name = os.path.split(os.path.dirname(worldtype.__file__))[1]
world_directory = os.path.join("worlds", file_name)
if os.path.isfile(os.path.join(world_directory, "archipelago.json")):
manifest = json.load(open(os.path.join(world_directory, "archipelago.json")))
with open(os.path.join(world_directory, "archipelago.json"), mode="r", encoding="utf-8") as manifest_file:
manifest = json.load(manifest_file)
assert "game" in manifest, (
f"World directory {world_directory} has an archipelago.json manifest file, but it"