99from rlbot .interface import RLBOT_SERVER_IP , RLBOT_SERVER_PORT , SocketRelay
1010from rlbot .utils import fill_desired_game_state , gateway
1111from rlbot .utils .logging import DEFAULT_LOGGER
12- from rlbot .utils .os_detector import RLBOT_SERVER_NAME , OS , CURRENT_OS
12+ from rlbot .utils .os_detector import CURRENT_OS , OS , RLBOT_SERVER_NAME
1313
1414
1515class MatchManager :
@@ -23,10 +23,7 @@ class MatchManager:
2323 rlbot_server_port = RLBOT_SERVER_PORT
2424 initialized = False
2525
26- def __init__ (
27- self ,
28- rlbot_server_path : Path | None = None
29- ):
26+ def __init__ (self , rlbot_server_path : Path | None = None ):
3027 """
3128 Initialize a MatchManager.
3229 Args:
@@ -54,8 +51,14 @@ def ensure_server_started(self):
5451 otherwise the global installed RLBotServer will be used, if any.
5552 """
5653
57- exe_name = self .rlbot_server_path .stem if self .rlbot_server_path is not None and self .rlbot_server_path .is_file () else RLBOT_SERVER_NAME
58- self .rlbot_server_process , self .rlbot_server_port = gateway .find_server_process (exe_name )
54+ exe_name = (
55+ self .rlbot_server_path .stem
56+ if self .rlbot_server_path is not None and self .rlbot_server_path .is_file ()
57+ else RLBOT_SERVER_NAME
58+ )
59+ self .rlbot_server_process , self .rlbot_server_port = gateway .find_server_process (
60+ exe_name
61+ )
5962 if self .rlbot_server_process is not None :
6063 self .logger .info ("%s is already running!" , exe_name )
6164 return
@@ -64,8 +67,15 @@ def ensure_server_started(self):
6467 # Look in cwd or localappdata
6568 path = Path .cwd () / RLBOT_SERVER_NAME
6669 if not path .exists () and CURRENT_OS == OS .WINDOWS :
67- self .logger .debug (f"Could not find RLBotServer in cwd ('{ path .parent } '), trying %localappdata% instead." )
68- path = Path (os .environ .get ("LOCALAPPDATA" )) / "RLBot5" / "bin" / RLBOT_SERVER_NAME
70+ self .logger .debug (
71+ f"Could not find RLBotServer in cwd ('{ path .parent } '), trying %localappdata% instead."
72+ )
73+ path = (
74+ Path (os .environ .get ("LOCALAPPDATA" ))
75+ / "RLBot5"
76+ / "bin"
77+ / RLBOT_SERVER_NAME
78+ )
6979 if not path .exists ():
7080 raise FileNotFoundError (
7181 "Unable to find RLBotServer in the current working directory "
@@ -79,7 +89,9 @@ def ensure_server_started(self):
7989 if path .exists () and path .is_dir ():
8090 path = path / RLBOT_SERVER_NAME
8191 if not path .exists ():
82- raise FileNotFoundError (f"Unable to find RLBotServer at the specified path '{ path } '." )
92+ raise FileNotFoundError (
93+ f"Unable to find RLBotServer at the specified path '{ path } '."
94+ )
8395
8496 if path is None or not os .access (path , os .F_OK ):
8597 raise FileNotFoundError (
0 commit comments