| 264 | */ |
| 265 | |
| 266 | static void file_dirscan_impl( OBJECT * dir, scanback func, void * closure ) |
| 267 | { |
| 268 | file_info_t * const d = file_query( dir ); |
| 269 | if ( !d || !d->is_dir ) |
| 270 | return; |
| 271 | |
| 272 | /* Lazy collect the directory content information. */ |
| 273 | if ( list_empty( d->files ) ) |
| 274 | { |
| 275 | if ( DEBUG_BINDSCAN ) |
| 276 | printf( "scan directory %s\n", object_str( d->name ) ); |
| 277 | if ( file_collect_dir_content_( d ) < 0 ) |
| 278 | return; |
| 279 | } |
| 280 | |
| 281 | /* OS specific part of the file_dirscan operation. */ |
| 282 | file_dirscan_( d, func, closure ); |
| 283 | |
| 284 | /* Report the collected directory content. */ |
| 285 | { |
| 286 | LISTITER iter = list_begin( d->files ); |
| 287 | LISTITER const end = list_end( d->files ); |
| 288 | for ( ; iter != end; iter = list_next( iter ) ) |
| 289 | { |
| 290 | OBJECT * const path = list_item( iter ); |
| 291 | file_info_t const * const ffq = file_query( path ); |
| 292 | /* Using a file name read from a file_info_t structure allows OS |
| 293 | * specific implementations to store some kind of a normalized file |
| 294 | * name there. Using such a normalized file name then allows us to |
| 295 | * correctly recognize different file paths actually identifying the |
| 296 | * same file. For instance, an implementation may: |
| 297 | * - convert all file names internally to lower case on a case |
| 298 | * insensitive file system |
| 299 | * - convert the NTFS paths to their long path variants as that |
| 300 | * file system each file system entity may have a long and a |
| 301 | * short path variant thus allowing for many different path |
| 302 | * strings identifying the same file. |
| 303 | */ |
| 304 | (*func)( closure, ffq->name, 1 /* stat()'ed */, &ffq->time ); |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | |
| 310 | static void free_file_info( void * xfile, void * data ) |
no test coverage detected