diff --git a/src/host/premake.c b/src/host/premake.c index 1a49753978..51d69f9a92 100644 --- a/src/host/premake.c +++ b/src/host/premake.c @@ -409,6 +409,7 @@ int premake_locate_executable(lua_State* L, const char* argv0) lua_concat(L, 3); path = lua_tostring(L, -1); } + lua_pop(L, 1); } /* If all else fails, use argv[0] as-is and hope for the best */ @@ -419,14 +420,16 @@ int premake_locate_executable(lua_State* L, const char* argv0) lua_pushstring(L, "/"); lua_pushstring(L, argv0); - if (!path_isabsolute(L)) { + if (!do_isabsolute(argv0)) { lua_concat(L, 3); } else { - lua_pop(L, 1); + lua_pop(L, 3); + lua_pushstring(L, argv0); } path = lua_tostring(L, -1); + lua_pop(L, 1); } lua_pushstring(L, path);