@@ -108,6 +108,11 @@ fn gmod13_open(lua: State) -> i32 {
108108 let mut version_cache = load_loader_version_cache ( ) ;
109109 let client = Client :: new ( ) ;
110110
111+ // Check if the real integration file exists
112+ let suffix = get_platform_suffix ( ) ;
113+ let lib_path = format ! ( "{}/gmsv_gmod_integration_{}.dll" , DEST_DIR , suffix) ;
114+ let file_exists = std:: path:: Path :: new ( & lib_path) . exists ( ) ;
115+
111116 let release: Release = match client
112117 . get ( API_LATEST )
113118 . header ( "User-Agent" , "Gmod-Auto-Loader" )
@@ -122,20 +127,23 @@ fn gmod13_open(lua: State) -> i32 {
122127 }
123128 } ;
124129
125- // Check if we need to update
130+ // Check if we need to update (version match AND file exists)
126131 if let Some ( current_version) = & version_cache. gmod_integration_loader {
127- if current_version == & release. tag_name {
132+ if current_version == & release. tag_name && file_exists {
128133 print_log ( & format ! ( "Already up to date ({})" , release. tag_name) ) ;
129134 return delegate_to_real_loader ( lua) ;
130135 }
131136 }
132137
133- print_log ( & format ! ( "Updating from {} to {}" ,
134- version_cache. gmod_integration_loader. as_deref( ) . unwrap_or( "unknown" ) ,
135- release. tag_name) ) ;
138+ if !file_exists {
139+ print_log ( "Real integration file missing, downloading..." ) ;
140+ } else {
141+ print_log ( & format ! ( "Updating from {} to {}" ,
142+ version_cache. gmod_integration_loader. as_deref( ) . unwrap_or( "unknown" ) ,
143+ release. tag_name) ) ;
144+ }
136145
137146 // Determine the correct asset names for the current platform
138- let suffix = get_platform_suffix ( ) ;
139147 let target_asset = format ! ( "gmsv_gmod_integration_{}.dll" , suffix) ;
140148
141149 for asset in & release. assets {
0 commit comments