summaryrefslogtreecommitdiff
path: root/Runtime/Scripting/Path/Path.bind.cpp
blob: 920f586e5f7b056459777549d2e4151c9b0ec566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
}