ADDED: IsPathDirectory(), for convenience and more readability at user code
This commit is contained in:
parent
77ecd5befc
commit
0c0375f8ae
1 changed files with 19 additions and 4 deletions
20
src/rcore.c
20
src/rcore.c
|
|
@ -2825,10 +2825,24 @@ int ChangeDirectory(const char *dirPath)
|
|||
// Check if given path point to a file
|
||||
bool IsPathFile(const char *path)
|
||||
{
|
||||
struct stat result = { 0 };
|
||||
stat(path, &result);
|
||||
bool result = false;
|
||||
|
||||
return S_ISREG(result.st_mode);
|
||||
struct stat info = { 0 };
|
||||
stat(path, &info);
|
||||
|
||||
if (S_ISREG(info.st_mode)) result = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check if given path point to a directory
|
||||
bool IsPathDirectory(const char *path)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (!IsPathFile(path)) result = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check if fileName is valid for the platform/OS
|
||||
|
|
|
|||
Loading…
Reference in a new issue