summaryrefslogtreecommitdiff
path: root/core/src/xmake/path/translate.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/xmake/path/translate.c')
-rw-r--r--core/src/xmake/path/translate.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/core/src/xmake/path/translate.c b/core/src/xmake/path/translate.c
index ecb545098..8d1debda0 100644
--- a/core/src/xmake/path/translate.c
+++ b/core/src/xmake/path/translate.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "translate"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "translate"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,31 +33,32 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_path_translate(lua_State* lua)
-{
- // check
+tb_int_t xm_path_translate(lua_State *lua) {
tb_assert_and_check_return_val(lua, 0);
// get the path
size_t path_size = 0;
- tb_char_t const* path = luaL_checklstring(lua, 1, &path_size);
+ tb_char_t const *path = luaL_checklstring(lua, 1, &path_size);
tb_check_return_val(path, 0);
// get the option argument, e.g. {normalize = true}
tb_bool_t normalize = tb_false;
- if (lua_istable(lua, 2))
- {
+ if (lua_istable(lua, 2)) {
lua_pushstring(lua, "normalize");
lua_gettable(lua, 2);
- if (lua_toboolean(lua, -1))
+ if (lua_toboolean(lua, -1)) {
normalize = tb_true;
+ }
lua_pop(lua, 1);
}
// do path:translate()
tb_char_t data[TB_PATH_MAXN];
tb_size_t size = tb_path_translate_to(path, (tb_size_t)path_size, data, sizeof(data), normalize);
- if (size) lua_pushlstring(lua, data, (size_t)size);
- else lua_pushnil(lua);
+ if (size) {
+ lua_pushlstring(lua, data, (size_t)size);
+ } else {
+ lua_pushnil(lua);
+ }
return 1;
}