From a408dd332e427b538c7542025bcc8e07d3338f1e Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 24 Jul 2026 21:17:11 +0200 Subject: [PATCH] REVIEWED: `IsPathAbsolute()`, remove `isalpha()` dependency --- src/rcore.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index 27b80b3c9..dd60ab731 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -2859,13 +2859,13 @@ bool IsPathAbsolute(const char *path) if ((path != NULL) && (path[0] != '\0')) { #if defined(_WIN32) - // UNC path (\\server\share) + // Check 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; + // Check path starts with a drive letter (e.g. C:\ or D:/) + else if ((((path[0] >= 'A') && (path[0] <= 'Z')) || ((path[0] >= 'a') && (path[0] <= 'z'))) && + (path[1] != '\0') && (path[1] == ':') && (path[2] != '\0') && ((path[2] == '\\') || (path[2] == '/'))) result = true; #else - // POSIX: must start with / + // Check POSIX path, must start with / if (path[0] == '/') result = true; #endif }