summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/eina/eina_file_win32.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c
index 4398e0b384..9987fdfb4c 100644
--- a/src/lib/eina/eina_file_win32.c
+++ b/src/lib/eina/eina_file_win32.c
@@ -144,7 +144,7 @@ _eina_file_win32_first_file(const char *dir, WIN32_FIND_DATA *fd)
144 144
145 wdir = evil_char_to_wchar(dir); 145 wdir = evil_char_to_wchar(dir);
146 if (!wdir) 146 if (!wdir)
147 return NULL; 147 return INVALID_HANDLE_VALUE;
148 148
149 h = FindFirstFile(wdir, fd); 149 h = FindFirstFile(wdir, fd);
150 free(wdir); 150 free(wdir);
@@ -153,14 +153,14 @@ _eina_file_win32_first_file(const char *dir, WIN32_FIND_DATA *fd)
153#endif 153#endif
154 154
155 if (!h) 155 if (!h)
156 return NULL; 156 return INVALID_HANDLE_VALUE;
157 157
158 while ((fd->cFileName[0] == '.') && 158 while ((fd->cFileName[0] == '.') &&
159 ((fd->cFileName[1] == '\0') || 159 ((fd->cFileName[1] == '\0') ||
160 ((fd->cFileName[1] == '.') && (fd->cFileName[2] == '\0')))) 160 ((fd->cFileName[1] == '.') && (fd->cFileName[2] == '\0'))))
161 { 161 {
162 if (!FindNextFile(h, fd)) 162 if (!FindNextFile(h, fd))
163 return NULL; 163 return INVALID_HANDLE_VALUE;
164 } 164 }
165 165
166 return h; 166 return h;
@@ -181,7 +181,11 @@ _eina_file_win32_ls_iterator_next(Eina_File_Iterator *it, void **data)
181 Eina_Bool res = EINA_TRUE; 181 Eina_Bool res = EINA_TRUE;
182 182
183 if (it->handle == INVALID_HANDLE_VALUE) 183 if (it->handle == INVALID_HANDLE_VALUE)
184 return EINA_FALSE; 184 {
185 if (GetLastError() == ERROR_NO_MORE_FILES)
186 it->is_last = EINA_TRUE;
187 return EINA_FALSE;
188 }
185 189
186 is_last = it->is_last; 190 is_last = it->is_last;
187#ifdef UNICODE 191#ifdef UNICODE
@@ -263,7 +267,11 @@ _eina_file_win32_direct_ls_iterator_next(Eina_File_Direct_Iterator *it, void **d
263 Eina_Bool res = EINA_TRUE; 267 Eina_Bool res = EINA_TRUE;
264 268
265 if (it->handle == INVALID_HANDLE_VALUE) 269 if (it->handle == INVALID_HANDLE_VALUE)
266 return EINA_FALSE; 270 {
271 if (GetLastError() == ERROR_NO_MORE_FILES)
272 it->is_last = EINA_TRUE;
273 return EINA_FALSE;
274 }
267 275
268 attr = it->data.dwFileAttributes; 276 attr = it->data.dwFileAttributes;
269 is_last = it->is_last; 277 is_last = it->is_last;
@@ -580,7 +588,7 @@ eina_file_ls(const char *dir)
580 588
581 it->handle = _eina_file_win32_first_file(new_dir, &it->data); 589 it->handle = _eina_file_win32_first_file(new_dir, &it->data);
582 free(new_dir); 590 free(new_dir);
583 if (it->handle == INVALID_HANDLE_VALUE) 591 if ((it->handle == INVALID_HANDLE_VALUE) && (GetLastError() != ERROR_NO_MORE_FILES))
584 goto free_it; 592 goto free_it;
585 593
586 memcpy(it->dir, dir, length + 1); 594 memcpy(it->dir, dir, length + 1);
@@ -631,7 +639,7 @@ eina_file_direct_ls(const char *dir)
631 639
632 it->handle = _eina_file_win32_first_file(new_dir, &it->data); 640 it->handle = _eina_file_win32_first_file(new_dir, &it->data);
633 free(new_dir); 641 free(new_dir);
634 if (it->handle == INVALID_HANDLE_VALUE) 642 if ((it->handle == INVALID_HANDLE_VALUE) && (GetLastError() != ERROR_NO_MORE_FILES))
635 goto free_it; 643 goto free_it;
636 644
637 memcpy(it->dir, dir, length + 1); 645 memcpy(it->dir, dir, length + 1);