@@ -60,6 +60,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
6060 arg_path ( & args, & [ "-p" , "--path" , "--game-path" ] )
6161 . unwrap_or ( std:: env:: current_dir ( ) . unwrap ( ) ) ,
6262 ) ;
63+ utils:: set_mutex (
64+ & global:: CACHE_DIR ,
65+ arg_path ( & args, & [ "--cache" ] ) . unwrap_or ( utils:: get_mutex ( & global:: GAME_DIR ) . join ( "awtmp" ) ) ,
66+ ) ;
67+ utils:: set_mutex_opt ( & global:: CDN_HOST , arg_value ( & args, & [ "--cdn" ] ) ) ;
6368
6469 let client = args
6570 . iter ( )
@@ -68,30 +73,38 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
6873 if let Some ( client) = client {
6974 utils:: set_mutex ( & global:: GAME_CLIENT , Some ( client) ) ;
7075 utils:: set_mutex ( & global:: GAME , client. game ( ) ) ;
71- } else {
72- if let Some ( game) = game:: detect_game ( & utils:: get_mutex ( & global:: GAME_DIR ) ) {
73- utils:: set_mutex ( & global:: GAME , game) ;
74- println ! ( "Game: {:?}" , game) ;
76+ } else if let Some ( game) = game:: detect_game ( & utils:: get_mutex ( & global:: GAME_DIR ) ) {
77+ utils:: set_mutex ( & global:: GAME , game) ;
78+ println ! ( "Game: {:?}" , game) ;
7579
76- match game. clients ( ) . len ( ) {
77- 0 => {
78- println ! ( "No clients found for game" ) ;
79- return Ok ( ( ) ) ;
80- }
81- 1 => {
82- utils:: set_mutex ( & global:: GAME_CLIENT , Some ( game. clients ( ) [ 0 ] ) ) ;
83- }
84- _ => {
85- println ! ( "Multiple clients found for game, please specify one" ) ;
86- return Ok ( ( ) ) ;
87- }
80+ match game. clients ( ) . len ( ) {
81+ 0 => {
82+ println ! ( "No clients found for game" ) ;
83+ return Ok ( ( ) ) ;
84+ }
85+ 1 => {
86+ utils:: set_mutex ( & global:: GAME_CLIENT , Some ( game. clients ( ) [ 0 ] ) ) ;
87+ }
88+ _ => {
89+ println ! ( "Multiple clients found for game, please specify one" ) ;
90+ return Ok ( ( ) ) ;
8891 }
89- } else {
90- println ! ( "No game detected" ) ;
91- return Ok ( ( ) ) ;
9292 }
93+ } else {
94+ println ! ( "No game detected" ) ;
95+ return Ok ( ( ) ) ;
9396 }
9497
98+ println ! (
99+ "Running with\n Game dir {}\n Cache dir {}\n CDN host {}\n CDN protocol {}\n CDN branch {}\n Game {}" ,
100+ utils:: get_mutex( & global:: GAME_DIR ) . display( ) ,
101+ utils:: get_mutex( & global:: CACHE_DIR ) . display( ) ,
102+ utils:: get_mutex( & global:: CDN_HOST ) ,
103+ utils:: get_mutex( & global:: CDN_PROTOCOL ) ,
104+ utils:: get_mutex( & global:: CDN_BRANCH ) ,
105+ utils:: get_mutex( & global:: GAME ) . name( )
106+ ) ;
107+
95108 let game = utils:: get_mutex ( & global:: GAME ) ;
96109 let clients = game. clients ( ) ;
97110 println ! ( "Clients: {:?}" , clients) ;
0 commit comments