Pass Lua state to do_chdir(), for use by native code customizations

This commit is contained in:
Jason Perkins 2014-12-22 11:51:06 -05:00
parent e2d8acf864
commit dad1ee10e3
2 changed files with 4 additions and 4 deletions

View File

@ -126,7 +126,7 @@ static int chunk_wrapper(lua_State* L)
/* And make that the CWD (and fix the const cheat) */
if (filename[0] != '$') {
do_chdir(filename);
do_chdir(L, filename);
}
if (ptr) *ptr = '/';
@ -143,7 +143,7 @@ static int chunk_wrapper(lua_State* L)
/* Finally, restore the previous _SCRIPT variable and working directory
* before returning control to the previously executing script. */
do_chdir(cwd);
do_chdir(L, cwd);
lua_pushvalue(L, args + 1);
lua_setglobal(L, "_SCRIPT");
lua_pushvalue(L, args + 2);

View File

@ -7,7 +7,7 @@
#include "premake.h"
int do_chdir(const char* path)
int do_chdir(lua_State* L, const char* path)
{
int z;
@ -26,7 +26,7 @@ int os_chdir(lua_State* L)
{
const char* path = luaL_checkstring(L, 1);
int z = do_chdir(path);
int z = do_chdir(L, path);
if (!z)
{
lua_pushnil(L);