Skip to content

Commit 9edd736

Browse files
committed
esp8266/moduos: Add os.remove(), proxying to VFS object.
1 parent e8e116e commit 9edd736

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

esp8266/moduos.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "py/obj.h"
3333
#include "py/objtuple.h"
3434
#include "py/objstr.h"
35+
#include "py/runtime.h"
3536
#include "genhdr/mpversion.h"
3637
#include "user_interface.h"
3738

@@ -84,10 +85,16 @@ STATIC mp_obj_t os_listdir(mp_uint_t n_args, const mp_obj_t *args) {
8485
}
8586
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir);
8687

88+
STATIC mp_obj_t os_remove(mp_obj_t path_in) {
89+
return vfs_proxy_call(MP_QSTR_remove, 1, &path_in);
90+
}
91+
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove);
92+
8793
STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
8894
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) },
8995
{ MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) },
9096
{ MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&os_listdir_obj) },
97+
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_remove_obj) },
9198
#if MICROPY_VFS_FAT
9299
{ MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) },
93100
#endif

0 commit comments

Comments
 (0)