| 160 | */ |
| 161 | |
| 162 | void file_dirscan_( file_info_t * const d, scanback func, void * closure ) |
| 163 | { |
| 164 | assert( d ); |
| 165 | assert( d->is_dir ); |
| 166 | |
| 167 | /* Special case \ or d:\ : enter it */ |
| 168 | { |
| 169 | char const * const name = object_str( d->name ); |
| 170 | if ( name[ 0 ] == '\\' && !name[ 1 ] ) |
| 171 | { |
| 172 | (*func)( closure, d->name, 1 /* stat()'ed */, &d->time ); |
| 173 | } |
| 174 | else if ( name[ 0 ] && name[ 1 ] == ':' && name[ 2 ] && !name[ 3 ] ) |
| 175 | { |
| 176 | /* We have just entered a 3-letter drive name spelling (with a |
| 177 | * trailing slash), into the hash table. Now enter its two-letter |
| 178 | * variant, without the trailing slash, so that if we try to check |
| 179 | * whether "c:" exists, we hit it. |
| 180 | * |
| 181 | * Jam core has workarounds for that. Given: |
| 182 | * x = c:\whatever\foo ; |
| 183 | * p = $(x:D) ; |
| 184 | * p2 = $(p:D) ; |
| 185 | * There will be no trailing slash in $(p), but there will be one in |
| 186 | * $(p2). But, that seems rather fragile. |
| 187 | */ |
| 188 | OBJECT * const dir_no_slash = object_new_range( name, 2 ); |
| 189 | (*func)( closure, d->name, 1 /* stat()'ed */, &d->time ); |
| 190 | (*func)( closure, dir_no_slash, 1 /* stat()'ed */, &d->time ); |
| 191 | object_free( dir_no_slash ); |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | |
| 197 | /* |
no test coverage detected