create the folder if it doesn't exist

This commit is contained in:
GM 2023-01-23 08:59:48 +00:00
parent 65339b5435
commit c888632fa7
2 changed files with 3 additions and 1 deletions

2
.gitignore vendored
View File

@ -141,4 +141,4 @@ frontend/package-lock.json
bang-workspace.code-workspace bang-workspace.code-workspace
.vscode/ .vscode/
backend/games.pickle backend/save/*

View File

@ -813,6 +813,8 @@ def save_games():
while True: while True:
sio.sleep(2) sio.sleep(2)
if not save_lock: if not save_lock:
if not os.path.exists("save"):
os.mkdir("save")
with open('./save/games.pickle', 'wb') as f: with open('./save/games.pickle', 'wb') as f:
pickle.dump([g for g in games if g.started and not g.is_replay and not g.is_hidden], f) pickle.dump([g for g in games if g.started and not g.is_replay and not g.is_hidden], f)