Fix default search path for configurations

Modified lookup of system configuration to accomodate the new XDG
locations.

Add an XDG_CONFIG_DIR variable to cmake to help find/set the system-wide
configuration location.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Matthew William Cox 2008-07-18 01:51:47 -04:00 committed by Julien Danjou
parent 8329d7e1c5
commit 84796930b7
3 changed files with 12 additions and 4 deletions

View file

@ -233,6 +233,14 @@ else()
set(SYSCONFDIR ${PREFIX}/etc CACHE PATH "config directory")
endif()
#If an XDG Config Dir is specificed, use it instead
#of the default XDG configuration dir.
if(DEFINED XDG_CONFIG_DIR)
set(XDG_CONFIG_DIR ${XDG_CONFIG_SYS} CACHE PATH "xdg config directory")
else()
set(XDG_CONFIG_DIR ${SYSCONFDIR}/xdg CACHE PATH "xdg config directory")
endif()
# Hide to avoid confusion
mark_as_advanced(CMAKE_INSTALL_PREFIX)
@ -241,7 +249,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_SYSCONFDIR ${SYSCONFDIR}/xdg/${PROJECT_AWE_NAME})
set(AWESOME_SYSCONFDIR ${XDG_CONFIG_DIR}/${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 SYSCONFDIR "@SYSCONFDIR@"
#define XDG_CONFIG_DIR "@XDG_CONFIG_DIR@"
#cmakedefine WITH_DBUS
#cmakedefine WITH_IMLIB2

4
lua.c
View file

@ -560,8 +560,8 @@ luaA_parserc(const char *confpatharg)
if(!(len = a_strlen(xdg_config_dirs)))
{
xdg_config_dirs = SYSCONFDIR;
len = sizeof(SYSCONFDIR)-1;
xdg_config_dirs = XDG_CONFIG_DIR;
len = sizeof(XDG_CONFIG_DIR) - 1;
}
xdg_files = a_strsplit(xdg_config_dirs, len, ':');