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
This commit is contained in:
Xavier Del Campo Romero 2024-12-17 07:42:06 +01:00
parent ad907a7e64
commit b288af7b3b

View file

@ -433,11 +433,9 @@ windowsDirGetList(const char *dir)
if ( strcmp(FData.name, ".") != 0 && strcmp(FData.name, "..") != 0 ) { if ( strcmp(FData.name, ".") != 0 && strcmp(FData.name, "..") != 0 ) {
curf = (tFList*)calloc(1, sizeof(tFList)); curf = (tFList*)calloc(1, sizeof(tFList));
curf->name = strdup(FData.name); curf->name = strdup(FData.name);
if (FData.attrib & _A_NORMAL) { curf->type = FData.attrib & _A_SUBDIR ?
curf->type = FList::file; FList::dir : FList::file;
} else if (FData.attrib & _A_SUBDIR) {
curf->type = FList::dir;
}
if (flist == (tFList*)NULL) { if (flist == (tFList*)NULL) {
curf->next = curf; curf->next = curf;
curf->prev = curf; curf->prev = curf;