From 1829f9282c1ad392a529899b9572e85378de04fc Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 4 Sep 2026 18:24:04 +0200 Subject: [PATCH] ADDED: `IsFileHidden()` --- src/raylib.h | 1 + src/rcore.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index a28964f1c..8f88e3d23 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1149,6 +1149,7 @@ RLAPI int FileTextFindIndex(const char *fileName, const char *search); // Find t RLAPI bool FileExists(const char *fileName); // Check if file exists RLAPI bool DirectoryExists(const char *dirPath); // Check if directory path exists RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (recommended include point: .png, .wav) +RLAPI bool IsFileHidden(const char *filePath); // Check if file path (file or directory) is hidden by OS RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time) RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png') diff --git a/src/rcore.c b/src/rcore.c index cc777e4b9..4f6396ee9 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -2413,20 +2413,20 @@ bool IsFileExtension(const char *fileName, const char *ext) return result; } -// Check if a provided file path (or directory) is hidden by OS -bool IsFileHidden(const char *path) +// Check if file path (file or directory) is hidden by OS +bool IsFileHidden(const char *filePath) { bool result = false; #if defined(_WIN32) - unsigned long attribs = GetFileAttributesA(path); + unsigned long attribs = GetFileAttributesA(filePath); // Check !INVALID_FILE_ATTRIBUTES and FILE_ATTRIBUTE_HIDDEN - if ((attribs != -1) && ((attrs & 0x2UL) != 0)) result = true; + if ((attribs != -1) && ((attribs & 0x2UL) != 0)) result = true; #else - const char *base = strrchr(path, '/'); - base = (base? base + 1 : path); + const char *basePath = strrchr(filePath, '/'); + basePath = (basePath? basePath + 1 : filePath); - if ((base[0] == '.') && (strcmp(base, ".") != 0) && (strcmp(base, "..") != 0)) result = true; + if ((basePath[0] == '.') && (strcmp(basePath, ".") != 0) && (strcmp(basePath, "..") != 0)) result = true; #endif return result; }