Set system data path to exepath for binaries with automatic updates

Updates work only when the game data is at the same location as the binary.
If this is not the case then the game was probably installed differently,
for example via the distribution or with make install. In this case we
cannot do automatic updates but we also want to use a different system path.

This fixes the linux development snapshots and release tarballs. They were
broken in the sense that they didn't find their game data.
scancodes-fix
Armin Burgmeier 2012-02-03 23:43:18 +01:00
parent 6da98a26b5
commit 139184c540
2 changed files with 15 additions and 2 deletions

View File

@ -84,7 +84,7 @@ endif()
option(USE_OPEN_AL "Use OpenAL to play sounds" ${INITIAL_USE_OPEN_AL})
option(DEBUGREC "Debug records" OFF)
option(OC_BUILD_MULTIPROCESSOR "Use all processor cores to build" OFF)
option(WITH_AUTOMATIC_UPDATE "Build engine without automatic update support" ON)
option(WITH_AUTOMATIC_UPDATE "Build engine without automatic update support" OFF)
############################################################################
# Check for compiler quirks and features
@ -1257,6 +1257,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY
# Install the icon into share/icons/hicolor/48x48/apps/clonk.png. Do this by
# extracting the correct size from oc.ico. Currently this is layer 2 - let's
# hope that it stays this way.
# Only allow installation for WITH_AUTOMATIC_UPDATE because otherwise
# the installed binary wouldn't find its game data in the system data path.
IF(WITH_AUTOMATIC_UPDATE)
INSTALL(CODE "MESSAGE(SEND_ERROR \"Installation is only supported for WITH_AUTOMATIC_UPDATE disabled\")")
ENDIF()
# TODO: Check for convert at configure step?
install(DIRECTORY DESTINATION share/icons/hicolor/48x48/apps)
install(CODE "

View File

@ -460,10 +460,16 @@ void C4ConfigGeneral::DeterminePaths()
#elif defined(__linux__)
#ifdef OC_SYSTEM_DATA_DIR
#ifdef WITH_AUTOMATIC_UPDATE
// WITH_AUTOMATIC_UPDATE builds are our tarball releases and
// development snapshots, i.e. where the game data is at the
// same location as the executable.
SCopy(ExePath.getMData(),SystemDataPath);
#else
SCopy(OC_SYSTEM_DATA_DIR, SystemDataPath);
#endif
#else
#error Please define OC_SYSTEM_DATA_DIR!
//SCopy(ExePath,SystemDataPath);
#endif
#endif
AppendBackslash(SystemDataPath);