From 45843ec1d55ce3369a1340a3981bfae30c3bcf7e Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 24 Apr 2016 23:55:28 +0100 Subject: [PATCH] fix sub directory search for Windows Fixes a small issue related to #3408 --- src/platform/windows.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/platform/windows.c b/src/platform/windows.c index ab7cfc2c30..5bab2f164c 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -391,6 +391,14 @@ int platform_enumerate_directories_begin(const utf8 *directory) enumFileInfo = &_enumerateFileInfoList[i]; if (!enumFileInfo->active) { wcsncpy(enumFileInfo->pattern, wDirectory, MAX_PATH); + + // Ensure pattern ends with a slash + int patternLength = lstrlenW(enumFileInfo->pattern); + wchar_t lastChar = enumFileInfo->pattern[patternLength - 1]; + if (lastChar != '\\' && lastChar != '/') { + wcsncat(enumFileInfo->pattern, L"\\", MAX_PATH); + } + wcsncat(enumFileInfo->pattern, L"*", MAX_PATH); enumFileInfo->handle = NULL; enumFileInfo->active = true;