MultiServer.py: when loading a .zip, create the .archipelago next to it to consistently load the same savegame.

This commit is contained in:
Fabian Dill 2021-07-23 02:27:45 +02:00
parent f6b3dfe5ba
commit fc7d37def4
1 changed files with 4 additions and 5 deletions

View File

@ -1415,11 +1415,10 @@ async def main(args: argparse.Namespace):
with zipfile.ZipFile(data_filename) as zf: with zipfile.ZipFile(data_filename) as zf:
for file in zf.namelist(): for file in zf.namelist():
if file.endswith(".archipelago"): if file.endswith(".archipelago"):
import tempfile import os
tmp = tempfile.NamedTemporaryFile("w+b", delete=False) data_filename = os.path.join(os.path.dirname(data_filename), file)
tmp.write(zf.open(file).read()) with open(data_filename, "wb") as f:
tmp.close() f.write(zf.read(file))
data_filename = tmp.name
break break
else: else:
raise Exception("No .archipelago found in archive.") raise Exception("No .archipelago found in archive.")