summaryrefslogtreecommitdiff
path: root/filesystem-win.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-06 18:52:47 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-06 18:52:47 -0500
commitf9092e361420a44e6ed8e5a1fa13d3fad9f3d7de (patch)
treefa6fb3760fafb594de3b6d4c5b2979681ad8806b /filesystem-win.c
parent132dcb648981050990e34a44925e6b54d0dc008c (diff)
fix fs_list_directory
Diffstat (limited to 'filesystem-win.c')
-rw-r--r--filesystem-win.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/filesystem-win.c b/filesystem-win.c
index 4a66c09..52dc64d 100644
--- a/filesystem-win.c
+++ b/filesystem-win.c
@@ -21,9 +21,7 @@ static char **fs_list_directory(char const *dirname) {
int nfiles = 1, idx = 0;
char **files;
while (FindNextFile(fhandle, &find_data)) {
- if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
- ++nfiles;
- }
+ ++nfiles;
}
FindClose(fhandle);
// now, fill out files array
@@ -32,13 +30,11 @@ static char **fs_list_directory(char const *dirname) {
fhandle = FindFirstFileA(file_pattern, &find_data);
if (fhandle != INVALID_HANDLE_VALUE) {
do {
- if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
- if (idx < nfiles) {
- char *dup = _strdup(find_data.cFileName);
- if (dup) {
- files[idx++] = dup;
- } else break; // stop now
- }
+ if (idx < nfiles) {
+ char *dup = _strdup(find_data.cFileName);
+ if (dup) {
+ files[idx++] = dup;
+ } else break; // stop now
}
} while (FindNextFile(fhandle, &find_data));
files[idx] = NULL;