| 213 | */ |
| 214 | |
| 215 | int try_file_query_root( file_info_t * const info ) |
| 216 | { |
| 217 | WIN32_FILE_ATTRIBUTE_DATA fileData; |
| 218 | char buf[ 4 ]; |
| 219 | char const * const pathstr = object_str( info->name ); |
| 220 | if ( !pathstr[ 0 ] ) |
| 221 | { |
| 222 | buf[ 0 ] = '.'; |
| 223 | buf[ 1 ] = 0; |
| 224 | } |
| 225 | else if ( pathstr[ 0 ] == '\\' && ! pathstr[ 1 ] ) |
| 226 | { |
| 227 | buf[ 0 ] = '\\'; |
| 228 | buf[ 1 ] = '\0'; |
| 229 | } |
| 230 | else if ( pathstr[ 1 ] == ':' ) |
| 231 | { |
| 232 | if ( !pathstr[ 2 ] || ( pathstr[ 2 ] == '\\' && !pathstr[ 3 ] ) ) |
| 233 | { |
| 234 | buf[ 0 ] = pathstr[ 0 ]; |
| 235 | buf[ 1 ] = ':'; |
| 236 | buf[ 2 ] = '\\'; |
| 237 | buf[ 3 ] = '\0'; |
| 238 | } |
| 239 | else |
| 240 | { |
| 241 | return 0; |
| 242 | } |
| 243 | } |
| 244 | else |
| 245 | { |
| 246 | return 0; |
| 247 | } |
| 248 | |
| 249 | /* We have a root path */ |
| 250 | if ( !GetFileAttributesExA( buf, GetFileExInfoStandard, &fileData ) ) |
| 251 | { |
| 252 | info->is_dir = 0; |
| 253 | info->is_file = 0; |
| 254 | info->exists = 0; |
| 255 | timestamp_clear( &info->time ); |
| 256 | } |
| 257 | else |
| 258 | { |
| 259 | info->is_dir = fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; |
| 260 | info->is_file = !info->is_dir; |
| 261 | info->exists = 1; |
| 262 | timestamp_from_filetime( &info->time, &fileData.ftLastWriteTime ); |
| 263 | } |
| 264 | return 1; |
| 265 | } |
| 266 | |
| 267 | void file_query_( file_info_t * const info ) |
| 268 | { |
no test coverage detected