From 29f3fe70aeb5f566864c7868f7c89483547e92b4 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 13 May 2014 14:42:20 +1000 Subject: Extantz calls love, and love calls LuaSL, and clean out the need for scripts to twiddle the Lua paths. --- src/LuaSL/LuaSL_main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/LuaSL/LuaSL_main.c') diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index 0d8a6db..7d6fa99 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c @@ -221,8 +221,23 @@ static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_De int main(int argc, char **argv) { - gameGlobals ourGlobals; - int result = EXIT_FAILURE; + gameGlobals ourGlobals; + char *env, cwd[PATH_MAX], temp[PATH_MAX * 2]; + int result = EXIT_FAILURE; + + // Sigh, Elm has this great thing for dealing with bin, lib, and data directories, but this is not an Elm app, + // And Elm is too heavy for just that little bit. + // So just duplicate a bit of what we need here. Sorta. + getcwd(cwd, PATH_MAX); + env = getenv("LUA_CPATH"); + if (!env) env = ""; + sprintf(temp, "%s;%s/lib?.so;%s/?.so;%s/?.so", env, PACKAGE_LIB_DIR, PACKAGE_LIB_DIR, cwd); + setenv("LUA_CPATH", temp, 1); + + env = getenv("LUA_PATH"); + if (!env) env = ""; + sprintf(temp, "%s;%s/?.lua;%s/?.lua", env, PACKAGE_LIB_DIR, cwd); + setenv("LUA_PATH", temp, 1); memset(&ourGlobals, 0, sizeof(gameGlobals)); ourGlobals.address = "127.0.0.1"; -- cgit v1.1