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:
for file in zf.namelist():
if file.endswith(".archipelago"):
import tempfile
tmp = tempfile.NamedTemporaryFile("w+b", delete=False)
tmp.write(zf.open(file).read())
tmp.close()
data_filename = tmp.name
import os
data_filename = os.path.join(os.path.dirname(data_filename), file)
with open(data_filename, "wb") as f:
f.write(zf.read(file))
break
else:
raise Exception("No .archipelago found in archive.")