luaa: add XDG_CONFIG_DIR as include path

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-07 16:35:21 +01:00
parent e0816a3340
commit 8234da4517

12
luaa.c
View file

@ -949,6 +949,14 @@ luaA_parserc(const char *confpatharg, bool run)
xdg_config_dirs = XDG_CONFIG_DIR; xdg_config_dirs = XDG_CONFIG_DIR;
len = sizeof(XDG_CONFIG_DIR) - 1; len = sizeof(XDG_CONFIG_DIR) - 1;
} }
else
{
/* add XDG_CONFIG_DIR (/etc/xdg/awesome by default) as include path */
snprintf(path, sizeof(path),
"package.path = package.path .. \";%s/awesome/?.lua;%s/awesome/?/init.lua\"",
XDG_CONFIG_DIR, XDG_CONFIG_DIR);
luaA_dostring(globalconf.L, path);
}
xdg_files = a_strsplit(xdg_config_dirs, len, ':'); xdg_files = a_strsplit(xdg_config_dirs, len, ':');
@ -959,7 +967,9 @@ luaA_parserc(const char *confpatharg, bool run)
confpath = p_new(char, len); confpath = p_new(char, len);
a_strcpy(confpath, len, *buf); a_strcpy(confpath, len, *buf);
a_strcat(confpath, len, AWESOME_CONFIG_FILE); a_strcat(confpath, len, AWESOME_CONFIG_FILE);
snprintf(path, sizeof(path), "package.path = package.path .. \";%s/awesome/?.lua\"", *buf); snprintf(path, sizeof(path),
"package.path = package.path .. \";%s/awesome/?.lua;%s/awesome/?/init.lua\"",
*buf, *buf);
luaA_dostring(globalconf.L, path); luaA_dostring(globalconf.L, path);
if(!ret) if(!ret)
ret = luaA_loadrc(confpath, run); ret = luaA_loadrc(confpath, run);