Set the conffile value before executing the code

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2011-09-17 17:21:34 +02:00
parent 8a04ce9c97
commit f0ca5e7505
1 changed files with 8 additions and 4 deletions

12
luaa.c
View File

@ -853,13 +853,17 @@ luaA_loadrc(const char *confpath, bool run)
{
if(run)
{
/* Set the conffile right now so it can be used inside the
* configuration file. */
globalconf.conffile = a_strdup(confpath);
if(lua_pcall(globalconf.L, 0, LUA_MULTRET, 0))
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
else
{
globalconf.conffile = a_strdup(confpath);
return true;
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
/* An error happened, so reset this. */
globalconf.conffile = NULL;
}
else
return true;
}
else
{