From 9edd736ee62fe1c0b148e1ca7b09175594e25192 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 28 Mar 2016 12:50:07 +0300 Subject: [PATCH] esp8266/moduos: Add os.remove(), proxying to VFS object. --- esp8266/moduos.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/esp8266/moduos.c b/esp8266/moduos.c index 36bd8137e3..b70c5b9067 100644 --- a/esp8266/moduos.c +++ b/esp8266/moduos.c @@ -32,6 +32,7 @@ #include "py/obj.h" #include "py/objtuple.h" #include "py/objstr.h" +#include "py/runtime.h" #include "genhdr/mpversion.h" #include "user_interface.h" @@ -84,10 +85,16 @@ STATIC mp_obj_t os_listdir(mp_uint_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir); +STATIC mp_obj_t os_remove(mp_obj_t path_in) { + return vfs_proxy_call(MP_QSTR_remove, 1, &path_in); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove); + 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) }, { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&os_listdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_remove_obj) }, #if MICROPY_VFS_FAT { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, #endif