MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / setprogdir

Function setprogdir

Source/Misc/lua/src/lua.c:12865–12877  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12863#undef setprogdir
12864
12865static void setprogdir (lua_State *L) {
12866char buff[MAX_PATH + 1];
12867char *lb;
12868DWORD nsize = sizeof(buff)/sizeof(char);
12869DWORD n = GetModuleFileNameA(NULL, buff, nsize);
12870if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
12871luaL_error(L, "unable to get ModuleFileName");
12872else {
12873*lb = '\0';
12874luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff);
12875lua_remove(L, -2); /* remove original string */
12876}
12877}
12878
12879
12880static void pusherror (lua_State *L) {

Callers 1

setpathFunction · 0.85

Calls 3

luaL_errorFunction · 0.85
luaL_gsubFunction · 0.85
lua_removeFunction · 0.85

Tested by

no test coverage detected