Commit 64926527 authored by Guido van Rossum's avatar Guido van Rossum

In Win32 version of listdir(), when FindFirstFile() returns

ERROR_FILE_NOT_FOUND, return an empty list instead of raising an
exception.
parent 94c04b6b
...@@ -644,6 +644,8 @@ posix_listdir(self, args) ...@@ -644,6 +644,8 @@ posix_listdir(self, args)
hFindFile = FindFirstFile(namebuf, &FileData); hFindFile = FindFirstFile(namebuf, &FileData);
if (hFindFile == INVALID_HANDLE_VALUE) { if (hFindFile == INVALID_HANDLE_VALUE) {
errno = GetLastError(); errno = GetLastError();
if (errno == ERROR_FILE_NOT_FOUND)
return PyList_New(0);
return posix_error(); return posix_error();
} }
do { do {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment