diff options
author | Peter Drahos <drahosp@gmail.com> | 2010-12-17 03:21:10 +0100 |
---|---|---|
committer | Peter Drahos <drahosp@gmail.com> | 2010-12-17 03:21:10 +0100 |
commit | 923d1e34568df985ff7613891a0231541a0b92c8 (patch) | |
tree | 5f34bdcf004e6a14c4774b53207e1d16ca7d2486 | |
parent | 8c966e95c726a4620c9ea483d424c454ca759c76 (diff) | |
download | lua-923d1e34568df985ff7613891a0231541a0b92c8.tar.gz |
Minor modifications for correct Cygwin handling
-rw-r--r-- | src/loadlib.c | 6 | ||||
-rw-r--r-- | src/luaconf.h | 40 |
2 files changed, 25 insertions, 21 deletions
diff --git a/src/loadlib.c b/src/loadlib.c index 60b7aa2..97f63be 100644 --- a/src/loadlib.c +++ b/src/loadlib.c @@ -59,13 +59,13 @@ static void setprogdir (lua_State *L) { char *lb; int nsize = sizeof(progdir)/sizeof(char); int n; -#if defined(_WIN32) - n = GetModuleFileNameA(NULL, progdir, nsize); -#elif defined(__CYGWIN__) +#if defined(__CYGWIN__) char win_buff[PATH_MAX + 1]; GetModuleFileNameA(NULL, win_buff, nsize); cygwin_conv_to_posix_path(win_buff, progdir); n = strlen(progdir); +#elif defined(_WIN32) + n = GetModuleFileNameA(NULL, progdir, nsize); #elif defined(__linux__) n = readlink("/proc/self/exe", progdir, nsize); if (n > 0) progdir[n] = 0; diff --git a/src/luaconf.h b/src/luaconf.h index d913b1b..1362d42 100644 --- a/src/luaconf.h +++ b/src/luaconf.h @@ -82,7 +82,25 @@ ** Any exclamation mark ('!') in the path is replaced by the ** path of the directory of the executable file of the current process. */ -#if defined(_WIN32) +#if defined(__CYGWIN__) + +#define LUADIST_LDIR "!/../share/lua/lmod/" +#define LUADIST_CDIR "!/../share/lua/cmod/" + +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/5.1/" +#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" + +#define LUA_PATH_DEFAULT "./?.lua;" \ + LUADIST_LDIR"?.lua;" LUADIST_LDIR"?/init.lua;" \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" + +#define LUA_CPATH_DEFAULT "./?.dll;" \ + LUADIST_CDIR"?.dll;" LUADIST_CDIR"loadall.dll;" \ + LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + +#elif defined(_WIN32) #define LUADIST_LDIR "!\\..\\share\\lua\\lmod\\" #define LUADIST_CDIR "!\\..\\share\\lua\\cmod\\" @@ -99,23 +117,7 @@ LUADIST_CDIR"?.dll;" LUADIST_CDIR"loadall.dll;" \ LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" -#elif defined(__CYGWIN__) -#define LUADIST_LDIR "!/../share/lua/lmod/" -#define LUADIST_CDIR "!/../share/lua/cmod/" - -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/5.1/" -#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" - -#define LUA_PATH_DEFAULT "./?.lua;" \ - LUADIST_LDIR"?.lua;" LUADIST_LDIR"?/init.lua;" \ - LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" - -#define LUA_CPATH_DEFAULT "./?.dll;" \ - LUADIST_CDIR"?.dll;" LUADIST_CDIR"loadall.dll;" \ - LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" #else #define LUADIST_LDIR "!/../share/lua/lmod/" @@ -141,7 +143,9 @@ ** CHANGE it if your machine does not use "/" as the directory separator ** and is not Windows. (On Windows Lua automatically uses "\".) */ -#if defined(_WIN32) +#if defined(__CYGWIN__) +#define LUA_DIRSEP "/" +#elif defined(_WIN32) #define LUA_DIRSEP "\\" #else #define LUA_DIRSEP "/" |