From b288af7b3b04b796109293cb6d9da7a9a84b86e4 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Tue, 17 Dec 2024 07:42:06 +0100 Subject: [PATCH] windowsspec.cpp: Fix wrong file attribute lookup Regular files in Windows might not only include the _A_NORMAL attribute [1]. In fact, experiments with WINE revealed that most files would in fact include the _A_ARCH attribute. Otherwise, most files would default to FList::unknown and therefore functions relying on FList::file would not work. [1]: https://learn.microsoft.com/en-us/cpp/c-runtime-library/filename-search-functions?view=msvc-170 Former-commit-id: 4fb5d0a07fe84b67ebe6541a7e0c9bc630579b42 Former-commit-id: 6dc6253ef0a737ab1c7881adc9b02088e7722243 --- src/libs/tgf/windowsspec.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libs/tgf/windowsspec.cpp b/src/libs/tgf/windowsspec.cpp index 436859d7c..6dd58ef76 100644 --- a/src/libs/tgf/windowsspec.cpp +++ b/src/libs/tgf/windowsspec.cpp @@ -433,11 +433,9 @@ windowsDirGetList(const char *dir) if ( strcmp(FData.name, ".") != 0 && strcmp(FData.name, "..") != 0 ) { curf = (tFList*)calloc(1, sizeof(tFList)); curf->name = strdup(FData.name); - if (FData.attrib & _A_NORMAL) { - curf->type = FList::file; - } else if (FData.attrib & _A_SUBDIR) { - curf->type = FList::dir; - } + curf->type = FData.attrib & _A_SUBDIR ? + FList::dir : FList::file; + if (flist == (tFList*)NULL) { curf->next = curf; curf->prev = curf;