-/*
- * Async thread which scans local files for boards, as well as scheduling
- * synchronous calls to the workshop
- */
-VG_STATIC void world_scan_thread( void *_args )
-{
- vg_linear_clear( vg_mem.scratch );
-
- for( u32 i=0; i<global_skateshop.t1_world_registry_count; i++ ){
- struct registry_world *reg = &global_skateshop.world_registry[i];
- reg->state = k_registry_board_state_indexed_absent;
- }
-
- /*
- * Local disk scan
- */
- vg_info( "Scanning maps/*.mdl\n" );
-
- char path_buf[4096];
- vg_str path;
- vg_strnull( &path, path_buf, 4096 );
- vg_strcat( &path, "maps/" );
-
- DIR *dir = opendir( path.buffer );
- if( !dir ){
- vg_error( "opendir('maps') failed\n" );
- vg_async_call( workshop_async_any_complete, NULL, 0 );
- return;
- }
-
- struct dirent *entry;
- while( (entry = readdir(dir)) ){
- if( entry->d_type == DT_DIR ){
- if( entry->d_name[0] == '.' ) continue;
-
- vg_str folder = path;
- char *folder_name = folder.buffer+folder.i;
-
- if( strlen( entry->d_name ) >
- vg_list_size(global_skateshop.world_registry[0].foldername)){
- vg_warn( "Map folder too long: %s\n", entry->d_name );
- continue;
- }
-
- vg_strcat( &folder, entry->d_name );
- if( !vg_strgood( &folder ) ) break;
-
- DIR *subdir = opendir( folder.buffer );
- while( (entry = readdir(subdir)) ){
- if( entry->d_type == DT_REG ){
- if( entry->d_name[0] == '.' ) continue;
-
- vg_str file = folder;
- vg_strcat( &file, "/" );
- vg_strcat( &file, entry->d_name );
- if( !vg_strgood( &file ) ) break;
-
- char *ext = vg_strch( &file, '.' );
- if( !ext ) continue;
- if( strcmp(ext,".mdl") ) continue;
-
- vg_strcat( &folder, "" );
- world_scan_register_local( folder_name );
- }
- }
- closedir(subdir);
- }
- }
- closedir(dir);
-
- vg_async_call( workshop_async_world_reg_update, NULL, 0 );
-
-#if 0
- tinydir_close(&dir);
-
- if( steam_ready ) workshop_steam_scan();
-
- vg_async_call( workshop_async_reg_update, NULL, 0 );