summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-04 00:57:05 +0800
committerruki <[email protected]>2023-03-04 00:57:05 +0800
commit95bde15f54e6dfffe5eeeee2a04e697f615e8868 (patch)
tree8996e4ed8b9ec01539b62b4186c088020da84ba4 /core/src
parent9f5e98c4cc256d3321d4d5e23037304e723cdb93 (diff)
improve fscase
Diffstat (limited to 'core/src')
m---------core/src/tbox/tbox0
-rw-r--r--core/src/xmake/engine.c2
-rw-r--r--core/src/xmake/os/fscase.c46
3 files changed, 48 insertions, 0 deletions
diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox
-Subproject 04cc154a906fd2670989bc1648c857a35a47671
+Subproject 577ec239822be88861a0f4a80e33485409e36c2
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c
index 17370a8ea..8baac18c6 100644
--- a/core/src/xmake/engine.c
+++ b/core/src/xmake/engine.c
@@ -101,6 +101,7 @@ tb_int_t xm_os_isfile(lua_State* lua);
tb_int_t xm_os_touch(lua_State* lua);
tb_int_t xm_os_rmfile(lua_State* lua);
tb_int_t xm_os_cpfile(lua_State* lua);
+tb_int_t xm_os_fscase(lua_State* lua);
tb_int_t xm_os_rename(lua_State* lua);
tb_int_t xm_os_exists(lua_State* lua);
tb_int_t xm_os_setenv(lua_State* lua);
@@ -321,6 +322,7 @@ static luaL_Reg const g_os_functions[] =
, { "touch", xm_os_touch }
, { "rmfile", xm_os_rmfile }
, { "cpfile", xm_os_cpfile }
+, { "fscase", xm_os_fscase }
, { "rename", xm_os_rename }
, { "exists", xm_os_exists }
, { "setenv", xm_os_setenv }
diff --git a/core/src/xmake/os/fscase.c b/core/src/xmake/os/fscase.c
new file mode 100644
index 000000000..917a5dc75
--- /dev/null
+++ b/core/src/xmake/os/fscase.c
@@ -0,0 +1,46 @@
+/*!A cross-platform build utility based on Lua
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Copyright (C) 2015-present, TBOOX Open Source Group.
+ *
+ * @author ruki
+ * @file fscase.c
+ *
+ */
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * trace
+ */
+#define TB_TRACE_MODULE_NAME "fscase"
+#define TB_TRACE_MODULE_DEBUG (0)
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * implementation
+ */
+tb_int_t xm_os_fscase(lua_State* lua)
+{
+ // check
+ tb_assert_and_check_return_val(lua, 0);
+
+ tb_char_t const* path = luaL_checkstring(lua, 1);
+ tb_check_return_val(path, 0);
+
+ lua_pushinteger(lua, (tb_int_t)tb_file_fscase(path));
+ return 1;
+}