ADDED: IsPathAbsolute() to check absolute paths
This commit is contained in:
parent
b806e3d2ec
commit
cfccb83ddd
2 changed files with 23 additions and 0 deletions
|
|
@ -1162,6 +1162,7 @@ RLAPI int MakeDirectory(const char *dirPath); // Create di
|
||||||
RLAPI int ChangeDirectory(const char *dirPath); // Change working directory, 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 provided path points to a file
|
RLAPI bool IsPathFile(const char *path); // Check if provided path points to a file
|
||||||
RLAPI bool IsPathDirectory(const char *path); // Check if provided path points to a directory
|
RLAPI bool IsPathDirectory(const char *path); // Check if provided path points to a directory
|
||||||
|
RLAPI bool IsPathAbsolute(const char *path); // Check if provided path is an absolute path
|
||||||
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
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 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*'
|
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*'
|
||||||
|
|
|
||||||
22
src/rcore.c
22
src/rcore.c
|
|
@ -2842,6 +2842,28 @@ bool IsPathDirectory(const char *path)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if provided path is an absolute path
|
||||||
|
static bool IsPathAbsolute(const char *path)
|
||||||
|
{
|
||||||
|
int result = false;
|
||||||
|
|
||||||
|
if ((path != NULL) && (path[0] != '\0'))
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
// UNC path (\\server\share)
|
||||||
|
if ((path[0] == '\\') && (path[1] == '\\')) result = true;
|
||||||
|
// Drive letter (e.g. C:\ or D:/)
|
||||||
|
else if (isalpha((unsigned char)path[0]) && (path[1] == ':') &&
|
||||||
|
((path[2] == '\\') || (path[2] == '/'))) result = true;
|
||||||
|
#else
|
||||||
|
// POSIX: must start with /
|
||||||
|
if (path[0] == '/') result = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if fileName is valid for the platform/OS
|
// Check if fileName is valid for the platform/OS
|
||||||
bool IsFileNameValid(const char *fileName)
|
bool IsFileNameValid(const char *fileName)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue