config: fix load paths

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-09 08:15:17 +02:00
parent 845685ed18
commit 58eac8af1c
4 changed files with 9 additions and 11 deletions

View File

@ -346,7 +346,7 @@ endif()
# {{{ Installation
install(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin)
install(FILES ${AWE_LUA_FILES} ${AWE_LUAC_FILES} DESTINATION ${AWESOME_LUA_LIB_PATH})
install(FILES ${AWE_CONF_FILES} DESTINATION ${AWESOME_SYSCONFIG_DIR})
install(FILES ${AWE_CONF_FILES} DESTINATION ${AWESOME_SYSCONFDIR})
if(GENERATE_MANPAGES)
install(FILES ${AWE_MAN1_FILES} DESTINATION ${AWESOME_MAN_PATH}/man1)
install(FILES ${AWE_MAN5_FILES} DESTINATION ${AWESOME_MAN_PATH}/man5)

View File

@ -224,7 +224,7 @@ set(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
set(AWESOME_COMPILE_HOSTNAME ${BUILDHOSTNAME})
set(AWESOME_COMPILE_BY $ENV{USER})
set(AWESOME_RELEASE ${CODENAME})
set(AWESOME_SYSCONFIG_DIR ${SYSCONFDIR}/xdg/${PROJECT_AWE_NAME})
set(AWESOME_SYSCONFDIR ${SYSCONFDIR}/xdg/${PROJECT_AWE_NAME})
set(AWESOME_DATA_PATH ${PREFIX}/share/${PROJECT_AWE_NAME})
set(AWESOME_DOC_PATH ${PREFIX}/share/doc/${PROJECT_AWE_NAME})
set(AWESOME_MAN_PATH ${PREFIX}/share/man)

View File

@ -2,7 +2,7 @@
#define _CONFIG_H_
#define AWESOME_LUA_LIB_PATH "@AWESOME_LUA_LIB_PATH@"
#define AWESOME_SYSCONFIG_DIR "@AWESOME_SYSCONFIG_DIR@"
#define SYSCONFDIR "@SYSCONFDIR@"
#cmakedefine WITH_DBUS
#cmakedefine WITH_IMLIB2

14
lua.c
View File

@ -543,9 +543,9 @@ luaA_init(void)
luaA_dostring(L, "package.path = package.path .. \";" AWESOME_LUA_LIB_PATH "/?.lua\"");
}
#define XDG_CONFIG_HOME_DEFAULT "/.config/awesome/"
#define XDG_CONFIG_HOME_DEFAULT "/.config"
#define AWESOME_CONFIG_FILE "rc.lua"
#define AWESOME_CONFIG_FILE "/awesome/rc.lua"
/** Load a configuration file.
* \param rcfile The configuration file to load.
@ -570,10 +570,9 @@ luaA_parserc(const char *confpatharg)
if(a_strlen(confdir))
{
len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE) + sizeof("/awesome/") + 1;
len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE) + 1;
confpath = p_new(char, len);
a_strcpy(confpath, len, confdir);
a_strcat(confpath, len, "/awesome/");
}
else
{
@ -594,8 +593,8 @@ luaA_parserc(const char *confpatharg)
if(!(len = a_strlen(xdg_config_dirs)))
{
xdg_config_dirs = AWESOME_SYSCONFIG_DIR;
len = sizeof(AWESOME_SYSCONFIG_DIR);
xdg_config_dirs = SYSCONFDIR;
len = sizeof(SYSCONFDIR);
}
xdg_files = a_strsplit(xdg_config_dirs, len, ':');
@ -603,10 +602,9 @@ luaA_parserc(const char *confpatharg)
for(buf = xdg_files; *buf; buf++)
{
p_delete(&confpath);
len = a_strlen(*buf) + sizeof("AWESOME_CONFIG_FILE") + 2;
len = a_strlen(*buf) + sizeof("AWESOME_CONFIG_FILE") + 1;
confpath = p_new(char, len);
a_strcpy(confpath, len, *buf);
a_strcat(confpath, len, "/");
a_strcat(confpath, len, AWESOME_CONFIG_FILE);
if(luaL_dofile(globalconf.L, confpath))
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));