| 437 | */ |
| 438 | |
| 439 | static void file_dirscan_impl( OBJECT * dir, scanback func, void * closure ) |
| 440 | { |
| 441 | file_info_t * const d = file_query( dir ); |
| 442 | if ( !d || !d->is_dir ) |
| 443 | return; |
| 444 | |
| 445 | /* Lazy collect the directory content information. */ |
| 446 | if ( list_empty( d->files ) ) |
| 447 | { |
| 448 | if ( DEBUG_BINDSCAN ) |
| 449 | out_printf( "scan directory %s\n", object_str( d->name ) ); |
| 450 | if ( file_collect_dir_content_( d ) < 0 ) |
| 451 | return; |
| 452 | } |
| 453 | |
| 454 | /* OS specific part of the file_dirscan operation. */ |
| 455 | file_dirscan_( d, func, closure ); |
| 456 | |
| 457 | /* Report the collected directory content. */ |
| 458 | { |
| 459 | LISTITER iter = list_begin( d->files ); |
| 460 | LISTITER const end = list_end( d->files ); |
| 461 | for ( ; iter != end; iter = list_next( iter ) ) |
| 462 | { |
| 463 | OBJECT * const path = list_item( iter ); |
| 464 | file_info_t const * const ffq = file_query( path ); |
| 465 | /* Using a file name read from a file_info_t structure allows OS |
| 466 | * specific implementations to store some kind of a normalized file |
| 467 | * name there. Using such a normalized file name then allows us to |
| 468 | * correctly recognize different file paths actually identifying the |
| 469 | * same file. For instance, an implementation may: |
| 470 | * - convert all file names internally to lower case on a case |
| 471 | * insensitive file system |
| 472 | * - convert the NTFS paths to their long path variants as that |
| 473 | * file system each file system entity may have a long and a |
| 474 | * short path variant thus allowing for many different path |
| 475 | * strings identifying the same file. |
| 476 | */ |
| 477 | (*func)( closure, ffq->name, 1 /* stat()'ed */, &ffq->time ); |
| 478 | } |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | |
| 483 | static void free_file_archive_info( void * xarchive, void * data ) |
no test coverage detected