8000 Merge pull request #932 from dhalbert/listdir_root · sparkfun/circuitpython@5ce1d71 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5ce1d71

Browse files
authored
Merge pull request adafruit#932 from dhalbert/listdir_root
fix os.listdir() when current dir is '/'
2 parents 720042f + 327b0f7 commit 5ce1d71

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

shared-bindings/os/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) {
8787
if (n_args == 1) {
8888
path = mp_obj_str_get_str(args[0]);
8989
} else {
90-
path = "";
90+
path = mp_obj_str_get_str(common_hal_os_getcwd());
9191
}
9292
return common_hal_os_listdir(path);
9393
}

shared-module/os/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ mp_obj_t common_hal_os_listdir(const char* path) {
103103
iter.base.type = &mp_type_polymorph_iter;
104104
iter.iternext = mp_vfs_ilistdir_it_iternext;
105105
iter.cur.vfs = MP_STATE_VM(vfs_mount_table);
106-
iter.is_str = mp_obj_get_type(path) == &mp_type_str;
< 520C code>106+
iter.is_str = true;
107107
iter.is_iter = false;
108108
} else {
109109
iter_obj = mp_vfs_proxy_call(vfs, MP_QSTR_ilistdir, 1, &path_out);

0 commit comments

Comments
 (0)
0