diff options
author | Robert HH <robert@hammelrath.com> | 2016-05-31 18:22:35 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-05-31 23:00:38 +0300 |
commit | 4f3fbf09cc5f9e135a47744ccc89c72918a97812 (patch) | |
tree | 6f0bb24c3826a60271ef349198110a473d839b36 /esp8266 | |
parent | 15eb1ce52d27ee6ef18c9364f3274662bce1158e (diff) | |
download | micropython-4f3fbf09cc5f9e135a47744ccc89c72918a97812.tar.gz micropython-4f3fbf09cc5f9e135a47744ccc89c72918a97812.zip |
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.
Diffstat (limited to 'esp8266')
-rw-r--r-- | esp8266/moduos.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/esp8266/moduos.c b/esp8266/moduos.c index 44821d3ce9..74262d86b1 100644 --- a/esp8266/moduos.c +++ b/esp8266/moduos.c @@ -138,6 +138,11 @@ STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_dupterm_notify_obj, os_dupterm_notify); +STATIC mp_obj_t os_stat(mp_obj_t path_in) { + return vfs_proxy_call(MP_QSTR_stat, 1, &path_in); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); + STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, { 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[] = { { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&os_getcwd_obj) }, { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_remove_obj) }, { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&os_rename_obj) }, + { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&os_stat_obj) }, #endif }; |