X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=plomrogue-server.py;h=f78d12b71a932c4f8b7616ed8e967b41d4971ed9;hb=4a1ec3a53d32f27ef42b7a2fd49bb96a2c71ea57;hp=04bc1d699148d960b4d9cf1518cf80e7e6e04505;hpb=6ddf68a935708159d568f3b3dc6fcca3dc27aa89;p=plomrogue diff --git a/plomrogue-server.py b/plomrogue-server.py index 04bc1d6..f78d12b 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -1,4 +1,7 @@ -import errno, os, time +import errno +import os +import time + def setup_server_io(io_db): """Fill IO files DB with proper file( path)s. Write process IO test string. @@ -23,16 +26,17 @@ def setup_server_io(io_db): io_db["file_in"].close() io_db["file_in"] = open(io_db["path_in"], "r") + def cleanup_server_io(io_db): """Close and remove all files in IO files DB.""" io_db["file_out"].close() os.remove(io_db["path_out"]) io_db["file_in"].close() os.remove(io_db["path_in"]) - if "file_worldstate" in io_db: # This file is only set up - io_db["file_worldstate"].close() # properly when the game - if os.access(io_db["path_worldstate"], os.F_OK): # world is active, which is - os.remove(io_db["path_worldstate"]) # not guaranteed. + if "file_worldstate" in io_db: # This file's only set up + io_db["file_worldstate"].close() # properly when the game + if os.access(io_db["path_worldstate"], os.F_OK): # world is active, which + os.remove(io_db["path_worldstate"]) # is not guaranteed. io_db = {} try: