ADDED: IsPathDirectory(), for convenience and more readability at user code
This commit is contained in:
parent
77ecd5befc
commit
0c0375f8ae
2 changed files with 19 additions and 4 deletions
|
|
@ -1160,7 +1160,8 @@ RLAPI const char *GetWorkingDirectory(void); // Get curre
|
|||
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
||||
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
||||
RLAPI int ChangeDirectory(const char *dirPath); // Change working directory, returns 0 on success
|
||||
RLAPI bool IsPathFile(const char *path); // Check if given path is a file or a directory
|
||||
RLAPI bool IsPathFile(const char *path); // Check if given path points to a file
|
||||
RLAPI bool IsPathDirectory(const char *path); // Check if given path points to a directory
|
||||
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
||||
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan
|
||||
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: '*.*','FILES*','DIRS*'
|
||||
|
|
|
|||
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