diff --git a/CMakeLists.txt b/CMakeLists.txt index 81c51dd40..66d5a9f6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -723,7 +723,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") endif() if (${CMAKE_SYSTEM_NAME} MATCHES "Haiku") - target_link_libraries(supertuxkart vorbisfile) + target_link_libraries(supertuxkart be network vorbisfile) endif() if (USE_DNS_C) diff --git a/src/io/file_manager.cpp b/src/io/file_manager.cpp index 836e8b581..4b74b7c98 100644 --- a/src/io/file_manager.cpp +++ b/src/io/file_manager.cpp @@ -38,6 +38,11 @@ #include "io/assets_android.hpp" #endif +#ifdef __HAIKU__ +#include +#include +#endif + #include #include @@ -1008,6 +1013,19 @@ void FileManager::checkAndCreateConfigDir() const std::string CONFIGDIR("SuperTuxKart"); m_user_config_dir += CONFIGDIR; +#elif defined(__HAIKU__) + + BPath settings_dir; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &settings_dir, true, NULL) == B_OK) { + m_user_config_dir = std::string(settings_dir.Path()); + } else { + if (getenv("HOME") != NULL) + { + m_user_config_dir = getenv("HOME"); + m_user_config_dir += "/config/settings"; + } + } + #else // Remaining unix variants. Use the new standards for config directory @@ -1076,6 +1094,8 @@ void FileManager::checkAndCreateAddonsDir() #elif defined(__APPLE__) m_addons_dir = getenv("HOME"); m_addons_dir += "/Library/Application Support/SuperTuxKart/Addons/"; +#elif defined(__HAIKU__) + m_addons_dir = m_user_config_dir+"addons/"; #else m_addons_dir = checkAndCreateLinuxDir("XDG_DATA_HOME", "supertuxkart", ".local/share", ".stkaddons"); @@ -1108,7 +1128,7 @@ void FileManager::checkAndCreateAddonsDir() */ void FileManager::checkAndCreateScreenshotDir() { -#if defined(WIN32) +#if defined(WIN32) || defined(__HAIKU__) m_screenshot_dir = m_user_config_dir+"screenshots/"; #elif defined(__APPLE__) m_screenshot_dir = getenv("HOME"); @@ -1134,7 +1154,7 @@ void FileManager::checkAndCreateScreenshotDir() */ void FileManager::checkAndCreateReplayDir() { -#if defined(WIN32) +#if defined(WIN32) || defined(__HAIKU__) m_replay_dir = m_user_config_dir + "replay/"; #elif defined(__APPLE__) m_replay_dir = getenv("HOME"); @@ -1185,7 +1205,7 @@ void FileManager::checkAndCreateCachedTexturesDir() */ void FileManager::checkAndCreateGPDir() { -#if defined(WIN32) +#if defined(WIN32) || defined(__HAIKU__) m_gp_dir = m_user_config_dir + "grandprix/"; #elif defined(__APPLE__) m_gp_dir = getenv("HOME");