1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 19:32:49 +01:00

Merge pull request #86 from AMDmi3/freebsd

Add FreeBSD support
This commit is contained in:
Daniel Evans 2016-05-25 20:17:12 +01:00
commit a3cc04f4eb
2 changed files with 6 additions and 4 deletions

View File

@ -27,9 +27,11 @@ option(ENABLE_PROFILING "Enable detailed profiling metrics")
# #
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_definitions(-DRW_LINUX=1) add_definitions(-DRW_LINUX)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions(-DRW_OSX=1) add_definitions(-DRW_OSX)
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
add_definitions(-DRW_FREEBSD)
else () else ()
message(FATAL_ERROR "Unknown platform \"${CMAKE_SYSTEM_NAME}\". please update CMakeLists.txt.") message(FATAL_ERROR "Unknown platform \"${CMAKE_SYSTEM_NAME}\". please update CMakeLists.txt.")
endif () endif ()

View File

@ -43,7 +43,7 @@ bool GameConfig::isValid()
std::string GameConfig::getDefaultConfigPath() std::string GameConfig::getDefaultConfigPath()
{ {
#if RW_LINUX #if defined(RW_LINUX) || defined(RW_FREEBSD)
char* config_home = getenv("XDG_CONFIG_HOME"); char* config_home = getenv("XDG_CONFIG_HOME");
if (config_home != nullptr) { if (config_home != nullptr) {
return std::string(config_home) + "/" + kConfigDirectoryName; return std::string(config_home) + "/" + kConfigDirectoryName;
@ -53,7 +53,7 @@ std::string GameConfig::getDefaultConfigPath()
return std::string(home) + "/.config/" + kConfigDirectoryName; return std::string(home) + "/.config/" + kConfigDirectoryName;
} }
#elif RW_OSX #elif defined(RW_OSX)
char* home = getenv("HOME"); char* home = getenv("HOME");
if (home) if (home)
return std::string(home) + "/Library/Preferences/" + kConfigDirectoryName; return std::string(home) + "/Library/Preferences/" + kConfigDirectoryName;