REVIEWED: IsPathAbsolute(), remove isalpha() dependency
This commit is contained in:
parent
f0a8201733
commit
a408dd332e
1 changed files with 5 additions and 5 deletions
10
src/rcore.c
10
src/rcore.c
|
|
@ -2859,13 +2859,13 @@ bool IsPathAbsolute(const char *path)
|
||||||
if ((path != NULL) && (path[0] != '\0'))
|
if ((path != NULL) && (path[0] != '\0'))
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// UNC path (\\server\share)
|
// Check UNC path (\\server\share)
|
||||||
if ((path[0] == '\\') && (path[1] == '\\')) result = true;
|
if ((path[0] == '\\') && (path[1] == '\\')) result = true;
|
||||||
// Drive letter (e.g. C:\ or D:/)
|
// Check path starts with a drive letter (e.g. C:\ or D:/)
|
||||||
else if (isalpha((unsigned char)path[0]) && (path[1] == ':') &&
|
else if ((((path[0] >= 'A') && (path[0] <= 'Z')) || ((path[0] >= 'a') && (path[0] <= 'z'))) &&
|
||||||
((path[2] == '\\') || (path[2] == '/'))) result = true;
|
(path[1] != '\0') && (path[1] == ':') && (path[2] != '\0') && ((path[2] == '\\') || (path[2] == '/'))) result = true;
|
||||||
#else
|
#else
|
||||||
// POSIX: must start with /
|
// Check POSIX path, must start with /
|
||||||
if (path[0] == '/') result = true;
|
if (path[0] == '/') result = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue