X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=workshop.c;h=a2fe1fe5b36bc29bf32f8a00713842a57fbe4f48;hb=badfa88dd109bbae5628f58504402f4707569f73;hp=baa537ce5a8bca4dbf361c8ae90c9381d28c8ac4;hpb=b8ff92a2caafa557608b84f4a037a5b3ce2628f7;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/workshop.c b/workshop.c index baa537c..a2fe1fe 100644 --- a/workshop.c +++ b/workshop.c @@ -428,32 +428,32 @@ VG_STATIC void _workshop_form_submit_thread( void *data ) descriptor_str[descriptor.cur*2] = '\0'; vg_info( "binstr: %s\n", descriptor_str ); - DIR *dir = opendir( folder.buffer ); - if( !dir ){ + vg_dir dir; + if( !vg_dir_open( &dir, folder.buffer ) ){ vg_error( "could not open addon folder '%s'\n", folder.buffer ); vg_async_call( workshop_async_any_complete, NULL, 0 ); return; } - struct dirent *entry; - while( (entry = readdir(dir)) ){ - if( entry->d_type == DT_REG ){ - if( entry->d_name[0] == '.' ) continue; + while( vg_dir_next_entry(&dir) ){ + if( vg_dir_entry_type(&dir) == k_vg_entry_type_file ){ + const char *d_name = vg_dir_entry_name(&dir); + if( d_name[0] == '.' ) continue; vg_str file = folder; vg_strcat( &file, "/" ); - vg_strcat( &file, entry->d_name ); + vg_strcat( &file, d_name ); if( !vg_strgood( &file ) ) continue; char *ext = vg_strch( &file, '.' ); if( !ext ) continue; if( strcmp(ext,".mdl") ) continue; - vg_msg_wkvstr( &descriptor, "content", entry->d_name ); + vg_msg_wkvstr( &descriptor, "content", d_name ); break; } } - closedir(dir); + vg_dir_close(&dir); vg_str descriptor_file = folder; vg_strcat( &descriptor_file, "/addon.inf" ); @@ -578,8 +578,8 @@ VG_STATIC void _workshop_form_load_thread( void *data ) return; } - DIR *dir = opendir( folder.buffer ); - if( !dir ){ + vg_dir dir; + if( !vg_dir_open( &dir, folder.buffer ) ){ vg_error( "workshop async load failed: could not open folder\n" ); vg_async_call( workshop_form_loadmodel_async_error, NULL, 0 ); return; @@ -588,14 +588,14 @@ VG_STATIC void _workshop_form_load_thread( void *data ) vg_info( "Searching %s for model files\n", folder.buffer ); int found_mdl = 0; - struct dirent *entry; - while( (entry = readdir(dir)) ){ - if( entry->d_type == DT_REG ){ - if( entry->d_name[0] == '.' ) continue; + while( vg_dir_next_entry(&dir) ){ + if( vg_dir_entry_type(&dir) == k_vg_entry_type_file ){ + const char *d_name = vg_dir_entry_name(&dir); + if( d_name[0] == '.' ) continue; vg_str file = folder; vg_strcat( &file, "/" ); - vg_strcat( &file, entry->d_name ); + vg_strcat( &file, d_name ); if( !vg_strgood( &file ) ) continue; char *ext = vg_strch( &file, '.' ); @@ -605,7 +605,7 @@ VG_STATIC void _workshop_form_load_thread( void *data ) break; } } - closedir(dir); + vg_dir_close(&dir); if( !found_mdl ){ vg_error( "workshop async load failed: no model files found\n" ); @@ -754,7 +754,7 @@ VG_STATIC void workshop_op_download_and_view_submission( int result_index ) snprintf( workshop_form.addon_folder, vg_list_size( workshop_form.addon_folder ), - "Steam Cloud (%lu)", details.m_nPublishedFileId ); + "Steam Cloud ("PRINTF_U64")", details.m_nPublishedFileId ); workshop_form.submission.file_id = details.m_nPublishedFileId; workshop_form.file_intent = k_workshop_form_file_intent_keep_old;