From 72ba3e47dcb55d782054b1b48e7536c1d67c4268 Mon Sep 17 00:00:00 2001 From: Phil Gaiser Date: Mon, 15 Jun 2026 14:24:53 +0200 Subject: [PATCH] Improved handling of hidden files in scanDirectory() function. On Windows, hidden files and directories should be ignored when a directory is scanned for files to be processed. This makes the behaviour to be more aligned with how it works on Linux-based systems. [CL]: Improved handling of hidden files on Windows. [Issue#63] Signed-off-by: Phil Gaiser --- src/lib/c/win32/fileio.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/c/win32/fileio.c b/src/lib/c/win32/fileio.c index ff1f9dd..290ec16 100644 --- a/src/lib/c/win32/fileio.c +++ b/src/lib/c/win32/fileio.c @@ -170,11 +170,14 @@ void scanDirectory(char* dirPath, DirStack* stack, SourceFileList* list) { DWORD attributes = findData.dwFileAttributes; const bool isDirectory = (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0; const bool isRegularFile = isRegularFileAttr(attributes); - if (isRegularFile) { - appendFile(list, fullPath); - } else if (isDirectory) { - dirStackPush(stack, fullPath); - continue; + const bool isHidden = (attributes & FILE_ATTRIBUTE_HIDDEN) != 0; + if (!isHidden) { + if (isRegularFile) { + appendFile(list, fullPath); + } else if (isDirectory) { + dirStackPush(stack, fullPath); + continue; + } } free(fullPath); } while (FindNextFileW(found, &findData));