def os_listdir(path): dir_p = scandir.opendir(path.encode(scandir.file_system_encoding)) if not dir_p: raise scandir.posix_error(path) names = [] try: entry = scandir.ffi.new(scandir.dirent_p) result = scandir.ffi.new(scandir.dirent_pp) while True: if scandir.readdir_r(dir_p, entry, result): raise scandir.posix_error(path) if not result[0]: break name = scandir.ffi.string(entry.d_name).decode(scandir.file_system_encoding) if name not in ('.', '..'): names.append(name) finally: if scandir.closedir(dir_p): raise scandir.posix_error(path) return names
def os_listdir(path): dir_p = scandir.opendir(path.encode(scandir.file_system_encoding)) if not dir_p: raise scandir.posix_error(path) names = [] try: entry = scandir.dirent() result = scandir.dirent_p() while True: if scandir.readdir_r(dir_p, entry, result): raise scandir.posix_error(path) if not result: break name = entry.d_name.decode(scandir.file_system_encoding) if name not in ('.', '..'): names.append(name) finally: if scandir.closedir(dir_p): raise scandir.posix_error(path) return names
def os_listdir(path): dir_p = scandir.opendir(path.encode(scandir.file_system_encoding)) if not dir_p: raise scandir.posix_error(path) names = [] try: entry = scandir.Dirent() result = scandir.Dirent_p() while True: if scandir.readdir_r(dir_p, entry, result): raise scandir.posix_error(path) if not result: break name = entry.d_name.decode(scandir.file_system_encoding) if name not in (".", ".."): names.append(name) finally: if scandir.closedir(dir_p): raise scandir.posix_error(path) return names