示例#1
0
文件: path.c 项目: AlexShiLucky/tbox
/* //////////////////////////////////////////////////////////////////////////////////////
 * main
 */ 
tb_int_t tb_demo_platform_path_main(tb_int_t argc, tb_char_t** argv)
{
    // the absolute path
    tb_char_t path[TB_PATH_MAXN] = {0};
//    tb_trace_i("%s", tb_path_relative_to(argv[2], argv[1], path, TB_PATH_MAXN));
    tb_trace_i("%s", tb_path_absolute_to(argv[2], argv[1], path, TB_PATH_MAXN));
    return 0;
}
示例#2
0
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
tb_int_t xm_path_absolute(lua_State* lua)
{
    // check
    tb_assert_and_check_return_val(lua, 0);

    // get the path 
    tb_char_t const* path = luaL_checkstring(lua, 1);
    tb_check_return_val(path, 0);

    // get the root 
    tb_char_t const* root = luaL_optstring(lua, 2, tb_null);

    // done path:absolute(root) 
    tb_char_t data[TB_PATH_MAXN];
    lua_pushstring(lua, tb_path_absolute_to(root, path, data, sizeof(data) - 1));

    // ok
    return 1;
}
示例#3
0
文件: path.c 项目: richwu/tbox
tb_char_t const* tb_path_absolute(tb_char_t const* path, tb_char_t* data, tb_size_t maxn)
{
    return tb_path_absolute_to(tb_null, path, data, maxn);
}