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