parent
d8557834c0
commit
27dafa5ed5
10
unix/modos.c
10
unix/modos.c
|
@ -141,6 +141,15 @@ STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) {
|
|||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_obj, mod_os_getenv);
|
||||
|
||||
STATIC mp_obj_t mod_os_mkdir(mp_obj_t path_in) {
|
||||
// TODO: Accept mode param
|
||||
const char *path = mp_obj_str_get_str(path_in);
|
||||
int r = mkdir(path, 0777);
|
||||
RAISE_ERRNO(r, errno);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_mkdir_obj, mod_os_mkdir);
|
||||
|
||||
STATIC const mp_map_elem_t mp_module_os_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR__os) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_stat), (mp_obj_t)&mod_os_stat_obj },
|
||||
|
@ -150,6 +159,7 @@ STATIC const mp_map_elem_t mp_module_os_globals_table[] = {
|
|||
{ MP_OBJ_NEW_QSTR(MP_QSTR_system), (mp_obj_t)&mod_os_system_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_unlink),(mp_obj_t)&mod_os_unlink_obj},
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_getenv),(mp_obj_t)&mod_os_getenv_obj},
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_mkdir),(mp_obj_t)&mod_os_mkdir_obj},
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module_os_globals, mp_module_os_globals_table);
|
||||
|
|
|
@ -42,6 +42,7 @@ Q(statvfs)
|
|||
Q(system)
|
||||
Q(unlink)
|
||||
Q(getenv)
|
||||
Q(mkdir)
|
||||
|
||||
Q(ffi)
|
||||
Q(ffimod)
|
||||
|
|
Loading…
Reference in New Issue