[+] Implemented old behavour for storing user data (logs, saves etc) to path where Stratagus is installed. To use this feature, enable ENABLE_USEGAMEDIR option in CMake
This commit is contained in:
parent
7e9a32af91
commit
06d0641ddd
2 changed files with 16 additions and 2 deletions
|
@ -694,6 +694,7 @@ option(ENABLE_DOC "Generate Stratagus source code documentation with Doxygen" OF
|
|||
option(ENABLE_DEV "Install Stratagus game development headers files" OFF)
|
||||
option(ENABLE_UPX "Compress Stratagus executable binary with UPX packer" OFF)
|
||||
option(ENABLE_STRIP "Strip all symbols from executables" OFF)
|
||||
option(ENABLE_USEGAMEDIR "Place all files created by Stratagus(logs, savegames) in game directory(old behavior), otherwise place everything in user directory(new behavior)" OFF)
|
||||
|
||||
if(NOT WITH_RENDERER)
|
||||
if(OPENGL_FOUND)
|
||||
|
@ -893,6 +894,10 @@ if(ENABLE_STRIP)
|
|||
# TODO: Add support for other compilers
|
||||
endif()
|
||||
|
||||
if(ENABLE_USEGAMEDIR)
|
||||
add_definitions(-DUSE_GAME_DIR)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TOUCHSCREEN)
|
||||
add_definitions(-DUSE_TOUCHSCREEN)
|
||||
endif()
|
||||
|
@ -929,6 +934,12 @@ else()
|
|||
message("Static linking: No (Enable by param -DENABLE_STATIC=ON)")
|
||||
endif()
|
||||
|
||||
if(ENABLE_USEGAMEDIR)
|
||||
message("Place game files in: game directory (Place in user directory with -DENABLE_USEGAMEDIR=OFF)")
|
||||
else()
|
||||
message("Place game files in: user directory (Place in game directory with -DENABLE_USEGAMEDIR=ON)")
|
||||
endif()
|
||||
|
||||
if(WIN32 AND MSVC)
|
||||
message("Platform: Windows (MSVC)")
|
||||
elseif(WIN32 AND MINGW)
|
||||
|
|
|
@ -48,7 +48,9 @@ void Parameters::SetDefaultValues()
|
|||
|
||||
void Parameters::SetDefaultUserDirectory()
|
||||
{
|
||||
#ifdef USE_WIN32
|
||||
#ifdef USE_GAME_DIR
|
||||
userDirectory = StratagusLibPath;
|
||||
#elif USE_WIN32
|
||||
userDirectory = getenv("APPDATA");
|
||||
#else
|
||||
userDirectory = getenv("HOME");
|
||||
|
@ -58,7 +60,8 @@ void Parameters::SetDefaultUserDirectory()
|
|||
userDirectory += "/";
|
||||
}
|
||||
|
||||
#ifdef USE_WIN32
|
||||
#ifdef USE_GAME_DIR
|
||||
#elif USE_WIN32
|
||||
userDirectory += "Stratagus";
|
||||
#elif defined(USE_MAC)
|
||||
userDirectory += "Library/Stratagus";
|
||||
|
|
Loading…
Reference in a new issue