MCPcopy Create free account
hub / github.com/cppla/ServerStatus / fs_is_dir

Function fs_is_dir

server/src/system.c:1400–1424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1398}
1399
1400int 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
1426int fs_chdir(const char *path)
1427{

Callers 3

fs_listdirFunction · 0.85
fs_chdirFunction · 0.85
mainFunction · 0.85

Calls 2

str_formatFunction · 0.85
statClass · 0.85

Tested by

no test coverage detected