MCPcopy Create free account
hub / github.com/F-Stack/f-stack / setprogdir

Function setprogdir

app/redis-6.2.6/deps/lua/src/loadlib.c:97–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95#undef setprogdir
96
97static void setprogdir (lua_State *L) {
98 char buff[MAX_PATH + 1];
99 char *lb;
100 DWORD nsize = sizeof(buff)/sizeof(char);
101 DWORD n = GetModuleFileNameA(NULL, buff, nsize);
102 if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
103 luaL_error(L, "unable to get ModuleFileName");
104 else {
105 *lb = '\0';
106 luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff);
107 lua_remove(L, -2); /* remove original string */
108 }
109}
110
111
112static void pusherror (lua_State *L) {

Callers 1

setpathFunction · 0.85

Calls 4

strrchrFunction · 0.85
luaL_errorFunction · 0.70
luaL_gsubFunction · 0.70
lua_removeFunction · 0.70

Tested by

no test coverage detected