| 1398 | } |
| 1399 | |
| 1400 | int fs_is_dir(const char *path) |
| 1401 | { |
| 1402 | #if defined(CONF_FAMILY_WINDOWS) |
| 1403 | /* TODO: do this smarter */ |
| 1404 | WIN32_FIND_DATA finddata; |
| 1405 | HANDLE handle; |
| 1406 | char buffer[1024*2]; |
| 1407 | str_format(buffer, sizeof(buffer), "%s/*", path); |
| 1408 | |
| 1409 | if ((handle = FindFirstFileA(buffer, &finddata)) == INVALID_HANDLE_VALUE) |
| 1410 | return 0; |
| 1411 | |
| 1412 | FindClose(handle); |
| 1413 | return 1; |
| 1414 | #else |
| 1415 | struct stat sb; |
| 1416 | if (stat(path, &sb) == -1) |
| 1417 | return 0; |
| 1418 | |
| 1419 | if (S_ISDIR(sb.st_mode)) |
| 1420 | return 1; |
| 1421 | else |
| 1422 | return 0; |
| 1423 | #endif |
| 1424 | } |
| 1425 | |
| 1426 | int fs_chdir(const char *path) |
| 1427 | { |
no test coverage detected