From 41094a864191531db107831dfa1ddb18fc24436e Mon Sep 17 00:00:00 2001
From: Sebastian Wick <sebastian@sebastianwick.net>
Date: Fri, 19 Sep 2014 20:23:39 +0200
Subject: [PATCH] the global config path is not always $prefix/etc, so just
 define the whole path in the build system

---
 components/CMakeLists.txt      | 7 ++++++-
 components/files/linuxpath.cpp | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt
index b7c64e0c6..8b967336c 100644
--- a/components/CMakeLists.txt
+++ b/components/CMakeLists.txt
@@ -57,7 +57,12 @@ add_component_dir (misc
     utf8stream stringops resourcehelpers
     )
 
-add_definitions(-DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
+add_definitions(-DGLOBAL_DATA_PATH="${CMAKE_INSTALL_PREFIX}/share/games/")
+if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
+    add_definitions(-DGLOBAL_CONFIG_PATH="/etc/")
+else()
+    add_definitions(-DGLOBAL_CONFIG_PATH="${CMAKE_INSTALL_PREFIX}/etc/")
+endif()
 add_component_dir (files
     linuxpath androidpath windowspath macospath fixedpath multidircollection collections configurationmanager
     constrainedfiledatastream lowlevelfile
diff --git a/components/files/linuxpath.cpp b/components/files/linuxpath.cpp
index 990fd2637..a105bb928 100644
--- a/components/files/linuxpath.cpp
+++ b/components/files/linuxpath.cpp
@@ -69,7 +69,7 @@ boost::filesystem::path LinuxPath::getCachePath() const
 
 boost::filesystem::path LinuxPath::getGlobalConfigPath() const
 {
-    boost::filesystem::path globalPath(INSTALL_PREFIX "/etc/");
+    boost::filesystem::path globalPath(GLOBAL_CONFIG_PATH);
     return globalPath / mName;
 }
 
@@ -80,7 +80,7 @@ boost::filesystem::path LinuxPath::getLocalPath() const
 
 boost::filesystem::path LinuxPath::getGlobalDataPath() const
 {
-    boost::filesystem::path globalDataPath(INSTALL_PREFIX "/share/games/");
+    boost::filesystem::path globalDataPath(GLOBAL_DATA_PATH);
     return globalDataPath / mName;
 }