From 83e12170dbffa258fa4a23d80fb9b18547adc193 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 8 May 2014 08:53:36 +1000 Subject: Setup all the Lua paths in a central place. --- extantz.sh | 4 ++-- lib/skang.lua | 1 - src/GuiLua/test.sh | 1 - src/libraries/SledjHamr.c | 13 +++++++++++++ src/libraries/SledjHamr.h | 3 ++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/extantz.sh b/extantz.sh index 95b1daa..da274a8 100755 --- a/extantz.sh +++ b/extantz.sh @@ -2,6 +2,6 @@ wd=$(pwd) -export LUA_PATH="$wd/lib/?.lua;$wd/src/GuiLua/?.lua" -export LUA_CPATH="$wd/lib/lib?.so;$wd/lib/?.so;$wd/src/GuiLua/?.so" +export LUA_PATH="$wd/src/GuiLua/?.lua" +export LUA_CPATH="$wd/src/GuiLua/?.so" ./extantz diff --git a/lib/skang.lua b/lib/skang.lua index 33ae895..0f91e44 100644 --- a/lib/skang.lua +++ b/lib/skang.lua @@ -1012,7 +1012,6 @@ end -- Get our C functions installed into skang. -- This has to be after thingasm is defined. -package.cpath = package.cpath .. ';./lib/lib?.so;../lib/lib?.so;../../lib/lib?.so' local GuiLua = require 'GuiLua' diff --git a/src/GuiLua/test.sh b/src/GuiLua/test.sh index 0cf39d9..30e8742 100755 --- a/src/GuiLua/test.sh +++ b/src/GuiLua/test.sh @@ -2,5 +2,4 @@ wd=$(pwd) -export LUA_PATH="$wd/../../lib/?.lua;./?.lua" ../../skang -l test -foo "argy bargy" diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c index aa68774..6137199 100644 --- a/src/libraries/SledjHamr.c +++ b/src/libraries/SledjHamr.c @@ -2,6 +2,8 @@ void HamrTime(void *elm_main, char *domain) { + char *env, cwd[PATH_MAX], temp[PATH_MAX * 2]; + elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); elm_app_compile_data_dir_set(PACKAGE_DATA_DIR); elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR); @@ -20,4 +22,15 @@ void HamrTime(void *elm_main, char *domain) elm_app_info_set(elm_main, domain, "checkme.txt"); // Once this is all setup, the code can do - // elm_app_prefix_dir_get(); // or bin, lib, data, locale. + + getcwd(cwd, PATH_MAX); + env = getenv("LUA_CPATH"); + if (!env) env = ""; + sprintf(temp, "%s;%s/lib?.so;%s/?.so;%s/?.so", env, elm_app_lib_dir_get(), elm_app_lib_dir_get(), cwd); + setenv("LUA_CPATH", temp, 1); + + env = getenv("LUA_PATH"); + if (!env) env = ""; + sprintf(temp, "%s;%s/?.lua;%s/?.lua", env, elm_app_lib_dir_get(), cwd); + setenv("LUA_PATH", temp, 1); } diff --git a/src/libraries/SledjHamr.h b/src/libraries/SledjHamr.h index 2351507..956b37e 100644 --- a/src/libraries/SledjHamr.h +++ b/src/libraries/SledjHamr.h @@ -8,7 +8,8 @@ /* Enable access to unstable EFL EO API. */ #define EFL_EO_API_SUPPORT 1 -#include +//#include +#include #include -- cgit v1.1