Commit 600be15d authored by Xavier Thompson's avatar Xavier Thompson

Improve os.listdir

parent 0d3108ce
......@@ -6,6 +6,8 @@ from libc.errno cimport errno
from libc.stdio cimport FILE, fopen, fclose, fread, fwrite, ferror
from libc.stdio cimport stdin, stdout, stderr
from libc.string cimport strcmp
from posix cimport unistd
from ._os cimport DIR, struct_dirent, opendir, readdir, closedir
......@@ -50,6 +52,8 @@ cdef inline List[Str] listdir(Str path) nogil:
entry = readdir(d)
if entry is NULL:
break
if strcmp(entry.d_name, b'.') == 0 or strcmp(entry.d_name, b'..') == 0:
continue
entries.append(Str(entry.d_name))
read_error = errno
closedir(d)
......
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