From cf2ebd92a51ac4a0a88a3d643dde07f6b5369e1e Mon Sep 17 00:00:00 2001 From: "Way, No" Date: Fri, 9 May 2014 02:59:35 +1100 Subject: [PATCH] Now getting resource directory from cmake instead of hardcode; also enabled RESDIR for Release builds --- OpenSpades.h.in | 3 +++ Sources/Gui/Main.cpp | 9 ++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/OpenSpades.h.in b/OpenSpades.h.in index 8ba817c0..229b6f6f 100644 --- a/OpenSpades.h.in +++ b/OpenSpades.h.in @@ -20,3 +20,6 @@ #cmakedefine RESDIR_DEFINED #define RESDIR "${RESDIR}" + +#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" +#define OPENSPADES_INSTALL_RESOURCES "${OPENSPADES_INSTALL_RESOURCES}" diff --git a/Sources/Gui/Main.cpp b/Sources/Gui/Main.cpp index 97167269..2dd7f7a6 100644 --- a/Sources/Gui/Main.cpp +++ b/Sources/Gui/Main.cpp @@ -389,12 +389,7 @@ int main(int argc, char ** argv) spades::FileManager::AddFileSystem (new spades::DirectoryFileSystem("./Resources", false)); - spades::FileManager::AddFileSystem - (new spades::DirectoryFileSystem("/usr/local/share/games/openspades/Resources", false)); - - spades::FileManager::AddFileSystem - (new spades::DirectoryFileSystem("/usr/share/games/openspades/Resources", false)); - + spades::FileManager::AddFileSystem(new spades::DirectoryFileSystem(CMAKE_INSTALL_PREFIX "/" OPENSPADES_INSTALL_RESOURCES, false)); std::string xdg_data_home = home+"/.local/share"; @@ -480,7 +475,7 @@ int main(int argc, char ** argv) } // register resource directory specified by Makefile (or something) -#if defined(RESDIR_DEFINED) && !NDEBUG +#if defined(RESDIR_DEFINED) spades::FileManager::AddFileSystem(new spades::DirectoryFileSystem(RESDIR, false)); #endif