8000 esp8266/moduos.c: Add stat() to the module uos of esp8266. · lapsule/micropython@4f3fbf0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4f3fbf0

Browse files
robert-hhpfalcon
authored andcommitted
esp8266/moduos.c: Add stat() to the module uos of esp8266.
This implementation makes use of vfs.stat() and therefore has the same properties. Known issues for all ports: uos.stat(".") on the top level returns the error code 22, EINVAL. The same happens with uos.stat("dirname/") where dirname IS the name of a directory.
1 parent 15eb1ce commit 4f3fbf0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

esp8266/moduos.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) {
138138
}
139139
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_dupterm_notify_obj, os_dupterm_notify);
140140

141+
STATIC mp_obj_t os_stat(mp_obj_t path_in) {
142+
return vfs_proxy_call(MP_QSTR_stat, 1, &path_in);
143+
}
144+
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat);
145+
141146
STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
142147
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) },
143148
{ MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) },
@@ -154,6 +159,7 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
154159
{ MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&os_getcwd_obj) },
155160
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_remove_obj) },
156161
{ MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&os_rename_obj) },
162+
{ MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&os_stat_obj) },
157163
#endif
158164
};
159165

0 commit comments

Comments
 (0)
0