summaryrefslogtreecommitdiff
path: root/Runtime/Scripting/Path
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-26 11:27:58 +0800
committerchai <chaifix@163.com>2021-10-26 11:27:58 +0800
commit32345800737b668011a87328cd3dcce59ec2934c (patch)
treee1bbd47ae775f1268447f1c1011ab10492ee9197 /Runtime/Scripting/Path
parentef7aedf5f272c52247d8ee9522d7b2896d21af63 (diff)
*misc
Diffstat (limited to 'Runtime/Scripting/Path')
-rw-r--r--Runtime/Scripting/Path/Path.bind.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/Runtime/Scripting/Path/Path.bind.cpp b/Runtime/Scripting/Path/Path.bind.cpp
new file mode 100644
index 0000000..920f586
--- /dev/null
+++ b/Runtime/Scripting/Path/Path.bind.cpp
@@ -0,0 +1,32 @@
+#include "Runtime/Lua/LuaBind/LuaBind.h"
+
+#ifdef GAMELAB_WIN
+#include <windows.h>
+#endif
+
+using namespace LuaBind;
+
+static int GetRootDirectory(lua_State* L)
+{
+#ifdef GAMELAB_WIN
+ char path[MAX_PATH];
+ GetCurrentDirectory(MAX_PATH, path);
+ lua_pushstring(L, path);
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+int luaopen_GameLab_Path(lua_State* L)
+{
+ LUA_BIND_STATE(L);
+
+ state.PushGlobalNamespace();
+ state.PushNamespace("GameLab");
+ state.PushNamespace("Path");
+
+ state.RegisterMethod("GetRootDirectory", GetRootDirectory);
+
+ return 1;
+}