package.path fix
This commit is contained in:
parent
60d0ba5ac6
commit
6fa2586afe
|
@ -622,7 +622,8 @@ int counter_fn(int interval, void *p)
|
||||||
int game_init(const char *name)
|
int game_init(const char *name)
|
||||||
{
|
{
|
||||||
getcwd(game_cwd, sizeof(game_cwd));
|
getcwd(game_cwd, sizeof(game_cwd));
|
||||||
|
unix_path(game_cwd);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
game_err_msg(NULL);
|
game_err_msg(NULL);
|
||||||
|
|
||||||
|
|
|
@ -411,19 +411,17 @@ static const luaL_Reg base_funcs[] = {
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
int instead_init(void)
|
static int instead_package(void)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
static char stead_path[PATH_MAX];
|
char stead_path[PATH_MAX] = "package.path=\"";
|
||||||
setlocale(LC_ALL,"");
|
|
||||||
setlocale(LC_NUMERIC,"C"); /* to avoid . -> , in numbers */
|
|
||||||
|
|
||||||
if (STEAD_PATH[0] == '.') {
|
if (STEAD_PATH[0] == '.') {
|
||||||
strcpy(stead_path, game_cwd);
|
strcat(stead_path, game_cwd);
|
||||||
strcat(stead_path, "/");
|
strcat(stead_path, "/");
|
||||||
strcat(stead_path, STEAD_PATH);
|
strcat(stead_path, STEAD_PATH);
|
||||||
} else {
|
} else {
|
||||||
strcpy(stead_path, STEAD_PATH);
|
strcat(stead_path, STEAD_PATH);
|
||||||
}
|
}
|
||||||
strcat(stead_path, "/?.lua");
|
strcat(stead_path, "/?.lua");
|
||||||
p = game_local_stead_path();
|
p = game_local_stead_path();
|
||||||
|
@ -432,15 +430,28 @@ int instead_init(void)
|
||||||
strcat(stead_path, p);
|
strcat(stead_path, p);
|
||||||
strcat(stead_path, "/?.lua");
|
strcat(stead_path, "/?.lua");
|
||||||
}
|
}
|
||||||
|
strcat(stead_path, "\"");
|
||||||
setenv("LUA_PATH", stead_path, 1);
|
instead_eval(stead_path); instead_clear();
|
||||||
|
/* putenv(stead_path); */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int instead_init(void)
|
||||||
|
{
|
||||||
|
setlocale(LC_ALL,"");
|
||||||
|
setlocale(LC_NUMERIC,"C"); /* to avoid . -> , in numbers */
|
||||||
// strcpy(curcp, "UTF-8");
|
// strcpy(curcp, "UTF-8");
|
||||||
|
|
||||||
/* initialize Lua */
|
/* initialize Lua */
|
||||||
|
|
||||||
L = lua_open();
|
L = lua_open();
|
||||||
if (!L)
|
if (!L)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
luaL_openlibs(L);
|
luaL_openlibs(L);
|
||||||
luaL_register(L, "_G", base_funcs);
|
luaL_register(L, "_G", base_funcs);
|
||||||
|
|
||||||
|
instead_package();
|
||||||
|
|
||||||
if (dofile(L,STEAD_PATH"/stead.lua")) {
|
if (dofile(L,STEAD_PATH"/stead.lua")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
putenv("SDL_MOUSE_RELATIVE=0"); /* test this! */
|
putenv("SDL_MOUSE_RELATIVE=0"); /* test this! */
|
||||||
getcwd(game_cwd, sizeof(game_cwd));
|
getcwd(game_cwd, sizeof(game_cwd));
|
||||||
|
unix_path(game_cwd);
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (!strcmp(argv[i],"-alsa"))
|
if (!strcmp(argv[i],"-alsa"))
|
||||||
alsa_sw = 1;
|
alsa_sw = 1;
|
||||||
|
|
Reference in a new issue