summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2022-03-09 23:34:29 +0800
committerruki <[email protected]>2022-03-09 23:34:29 +0800
commitaeda9da29923d4f2d9db63b3171ae9c108599559 (patch)
tree3a6316f8565c331604850fbe30e8c8b484f18135 /core/src
parentfc5875cacc7b0e14edc43b12142d6f6f6fdd100c (diff)
update tbox
Diffstat (limited to 'core/src')
m---------core/src/tbox/tbox0
-rw-r--r--core/src/xmake/path/translate.c10
2 files changed, 4 insertions, 6 deletions
diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox
-Subproject b763252ce256ca4a3459024072833c51d7534fc
+Subproject da64671b833ba8a7a56d882b9e170388504b70d
diff --git a/core/src/xmake/path/translate.c b/core/src/xmake/path/translate.c
index 1eabc2a79..87059c85c 100644
--- a/core/src/xmake/path/translate.c
+++ b/core/src/xmake/path/translate.c
@@ -39,7 +39,8 @@ tb_int_t xm_path_translate(lua_State* lua)
tb_assert_and_check_return_val(lua, 0);
// get the path
- tb_char_t const* path = luaL_checkstring(lua, 1);
+ size_t path_size = 0;
+ tb_char_t const* path = luaL_checklstring(lua, 1, &path_size);
tb_check_return_val(path, 0);
// get the option argument, e.g. {reduce_dot2 = true}
@@ -53,12 +54,9 @@ tb_int_t xm_path_translate(lua_State* lua)
lua_pop(lua, 1);
}
- // copy path
- tb_char_t data[TB_PATH_MAXN];
- tb_strlcpy(data, path, sizeof(data));
-
// do path:translate()
- tb_size_t size = tb_path_translate(data, 0, sizeof(data) - 1, reduce_dot2);
+ tb_char_t data[TB_PATH_MAXN];
+ tb_size_t size = tb_path_translate_to(path, (tb_size_t)path_size, data, sizeof(data), reduce_dot2);
if (size) lua_pushlstring(lua, data, (size_t)size);
else lua_pushnil(lua);
return 1;