Skip to content

Commit

Permalink
Pass data directory to the game
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Dec 22, 2011
1 parent 8ce8d32 commit 675a71a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ endif()
set(BINDIR "games" CACHE STRING "where to install game binary")
set(DATADIR "share/games/flare" CACHE STRING "where to install game data")

add_definitions(-DDATA_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${DATADIR}")

# Detect missing dependencies

Find_Package (SDL REQUIRED)
Expand Down
5 changes: 5 additions & 0 deletions src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ void setPaths() {
pathtest = eatFirstString(pathlist,':');
}
}

#if defined DATA_INSTALL_DIR
PATH_DATA = DATA_INSTALL_DIR "/";
if (dirExists(PATH_DATA)) return; // NOTE: early exit
#endif

// check /usr/local/share/flare/ and /usr/share/flare/ next
PATH_DATA = "/usr/local/share/" + engine_folder + "/";
Expand Down

0 comments on commit 675a71a

Please sign in to comment.