elua: remove the : prefix for running apps

Instead, check if there is a file specified by the argument to elua and
if there is, execute it, otherwise treat it as app name. The reason this
is done is that the colon triggered ugly stuff in certain environments,
such as our MinGW crossbuild Jenkins slave.

@fix
This commit is contained in:
Daniel Kolesa 2014-11-05 16:09:36 +00:00
parent d23b9342d5
commit f0f9edd0bd
2 changed files with 13 additions and 8 deletions

View File

@ -1,9 +1,9 @@
if HAVE_ELUA_BIN
ELUA_GEN = @elua_bin@ :lualian
ELUA_GEN = @elua_bin@ lualian
_ELUA_GEN_DEP = @elua_bin@
else
ELUA_GEN = ELUA_EOLIAN_LIBRARY_PATH=$(top_builddir)/src/lib/eolian/.libs \
EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT} :lualian
EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT} lualian
_ELUA_GEN_DEP = bin/elua/elua${EXEEXT} bin/elua/modules/lualian.lua
endif

View File

@ -93,10 +93,7 @@ elua_getargs(lua_State *L, int argc, char **argv, int n)
lua_createtable(L, narg, n + 1);
for (i = 0; i < argc; ++i)
{
if (!(i - n) && argv[i][0] == ':')
lua_pushstring(L, &argv[i][1]);
else
lua_pushstring(L, argv[i]);
lua_pushstring(L, argv[i]);
lua_rawseti(L, -2, i - n);
}
return narg;
@ -233,9 +230,17 @@ elua_doscript(lua_State *L, int argc, char **argv, int n, int *quit)
{
fname = NULL;
}
if (fname && fname[0] == ':')
if (fname)
{
status = !elua_loadapp(L, fname + 1);
/* check if there is a file of that name */
FILE *f = fopen(fname, "r");
if (f)
{
fclose(f);
status = elua_loadfile(L, fname);
}
else
status = !elua_loadapp(L, fname);
}
else
{