From c190c3efaec57dcb550a57a56538010ff5e2b532 Mon Sep 17 00:00:00 2001 From: Didier Raboud Date: Sun, 16 Dec 2012 21:29:13 +0100 Subject: Set a default datadir, in sync with the data installation path. --- CMakeLists.txt | 5 +++-- src/app/app.cpp | 3 ++- src/common/config.h.cmake | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d072fd0..5238c1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,5 +162,6 @@ endif() # Subdirectory with sources add_subdirectory(src bin) -# TODO: provide data files as git submodule and setup correct data path -install_files(/share/games/colobot ../data) +# TODO: provide data files as git submodule +set(COLOBOT_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/games/colobot CACHE PATH "Colobot shared data directory") +install(DIRECTORY ../data DESTINATION ${COLOBOT_DATA_DIR}) diff --git a/src/app/app.cpp b/src/app/app.cpp index 751ff21..980ecc1 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -15,6 +15,7 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. +#include "common/config.h" #include "app/app.h" @@ -130,7 +131,7 @@ CApplication::CApplication() m_mouseButtonsState = 0; m_trackedKeys = 0; - m_dataPath = "./data"; + m_dataPath = CBOT_DEFAULT_DATADIR; m_language = LANGUAGE_ENV; diff --git a/src/common/config.h.cmake b/src/common/config.h.cmake index 8c85df1..7cc2386 100644 --- a/src/common/config.h.cmake +++ b/src/common/config.h.cmake @@ -6,4 +6,6 @@ #cmakedefine PLATFORM_OTHER @PLATFORM_OTHER@ #cmakedefine USE_GLEW @USE_GLEW@ -#cmakedefine GLEW_STATIC \ No newline at end of file +#cmakedefine GLEW_STATIC + +#define CBOT_DEFAULT_DATADIR "@COLOBOT_DATA_DIR@" -- cgit v1.2.3-1-g7c22