From 0432b948ebfae569cd2f88818de5e43cd4c8883e Mon Sep 17 00:00:00 2001 From: gaithern Date: Wed, 6 Dec 2023 18:49:25 -0600 Subject: [PATCH] Fixed an issue where the clients would parse leftover files --- worlds/khcom/Client.py | 6 ++++++ worlds/khrecom/Client.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/worlds/khcom/Client.py b/worlds/khcom/Client.py index f27b3f3d8702..08169de57637 100644 --- a/worlds/khcom/Client.py +++ b/worlds/khcom/Client.py @@ -44,6 +44,12 @@ def __init__(self, server_address, password): self.game_communication_path = os.path.expandvars(r"%localappdata%/KHCOM") else: self.game_communication_path = os.path.expandvars(r"$HOME/KHCOM") + if not os.path.exists(self.game_communication_path): + os.makedirs(self.game_communication_path) + for root, dirs, files in os.walk(self.game_communication_path): + for file in files: + if file.find("obtain") <= -1: + os.remove(root+"/"+file) async def server_auth(self, password_requested: bool = False): if password_requested and not self.password: diff --git a/worlds/khrecom/Client.py b/worlds/khrecom/Client.py index 8f4a55d58c50..60b2f5909144 100644 --- a/worlds/khrecom/Client.py +++ b/worlds/khrecom/Client.py @@ -44,6 +44,12 @@ def __init__(self, server_address, password): self.game_communication_path = os.path.expandvars(r"%localappdata%/KHRECOM") else: self.game_communication_path = os.path.expandvars(r"$HOME/KHRECOM") + if not os.path.exists(self.game_communication_path): + os.makedirs(self.game_communication_path) + for root, dirs, files in os.walk(self.game_communication_path): + for file in files: + if file.find("obtain") <= -1: + os.remove(root+"/"+file) async def server_auth(self, password_requested: bool = False): if password_requested and not self.password: