diff options
| author | ruki <[email protected]> | 2017-02-08 22:11:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-02-08 22:11:42 +0800 |
| commit | f5571dea410131991ae7f836cc6a52d82890d894 (patch) | |
| tree | 1da5045f7df779ec47016fc8861fac8aae754f77 /core | |
| parent | f717d2da6d60566cfe84737950b311b4d7af9275 (diff) | |
improve os.rm and os.rmdir
Diffstat (limited to 'core')
| -rwxr-xr-x | core/src/xmake/os/mkdir.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/src/xmake/os/mkdir.c b/core/src/xmake/os/mkdir.c index d20218c5d..557833161 100755 --- a/core/src/xmake/os/mkdir.c +++ b/core/src/xmake/os/mkdir.c @@ -46,8 +46,11 @@ tb_int_t xm_os_mkdir(lua_State* lua) tb_char_t const* path = luaL_checkstring(lua, 1); tb_check_return_val(path, 0); - // done os.mkdir(path) - lua_pushboolean(lua, tb_directory_create(path)); + // os.mkdir(path) + tb_file_info_t info = {0}; + if (!tb_file_info(path, &info) || (info.type != TB_FILE_TYPE_DIRECTORY)) + lua_pushboolean(lua, tb_directory_create(path)); + else lua_pushboolean(lua, tb_true); // ok return 1; |
