changeset 1972:735ff8cd75d6

Fixing remaining problems of 'make install' on Unix -- the assumption that the binary is going to be run inside where the same directory as the resources and config files are clashes completely with the way that multiuser systems work. Some problems might still remain, but by now the creation of packages for GNU/Linux (or BSDs, etc) distributions should work without many hiccups.
author mafm
date Fri, 28 Oct 2011 00:03:36 +0000
parents b30989f75ea1
children 84c63abcdf06
files CMakeLists.txt src/gui/application.cpp src/gui/creditswindow.cpp
diffstat 3 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Oct 27 23:59:33 2011 +0000
+++ b/CMakeLists.txt	Fri Oct 28 00:03:36 2011 +0000
@@ -476,6 +476,7 @@
   DESTINATION share/icons/hicolor/128x128/
   RENAME sumwars.png)
 
+execute_process(COMMAND sed -i "s|\\=\\./|\\=/usr/share/games/sumwars/|g" "${CMAKE_CURRENT_SOURCE_DIR}/resources.cfg")
 install(FILES authors.txt
   DESTINATION share/games/sumwars)
 install(FILES resources.cfg ogre.cfg plugins.cfg
--- a/src/gui/application.cpp	Thu Oct 27 23:59:33 2011 +0000
+++ b/src/gui/application.cpp	Fri Oct 28 00:03:36 2011 +0000
@@ -794,8 +794,8 @@
 #endif
 	
 	Ogre::ConfigFile cf;
-#ifdef UNIX
-	cf.load(CFG_FILES_DIR + "/resources.cfg");
+#if defined(__unix__)
+	cf.load(std::string(CFG_FILES_DIR) + "/resources.cfg");
 #else
 	cf.load(path + "resources.cfg");
 #endif
--- a/src/gui/creditswindow.cpp	Thu Oct 27 23:59:33 2011 +0000
+++ b/src/gui/creditswindow.cpp	Fri Oct 28 00:03:36 2011 +0000
@@ -17,6 +17,8 @@
 #include "ceguiutility.h"
 #include "OgreConfigFile.h"
 
+#include "config.h"
+
 CreditsWindow::CreditsWindow(Document* doc)
 	:Window(doc)
 {
@@ -50,8 +52,10 @@
 	credits->setProperty("HorzFormatting", "HorzCentred");
 
 	Ogre::ConfigFile cf;
-#ifndef __APPLE__
+#if defined (__APPLE__)
 	cf.load("authors.txt");
+#elif defined (__unix__)
+	cf.load(std::string(CFG_FILES_DIR) + "authors.txt");
 #else
     Ogre::String path;
     CFBundleRef mainBundle = CFBundleGetMainBundle();