Update haiku file_manager handling code

This commit is contained in:
Benau 2023-03-12 08:26:20 +08:00
parent 1a3a944a97
commit 12a8b1da1d
2 changed files with 16 additions and 9 deletions

View File

@ -795,6 +795,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
endif()
if(HAIKU)
target_link_libraries(supertuxkart -lbe -lnetwork)
endif()
# Wiiuse
# ------
if(USE_WIIUSE)

View File

@ -1015,15 +1015,16 @@ void FileManager::checkAndCreateConfigDir()
#elif defined(__HAIKU__)
BPath settings_dir;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &settings_dir, true, NULL) == B_OK) {
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 if (getenv("HOME") != NULL)
{
m_user_config_dir = getenv("HOME");
m_user_config_dir += "/config/settings";
}
m_user_config_dir += "/SuperTuxKart";
#else
@ -1090,6 +1091,8 @@ void FileManager::checkAndCreateAddonsDir()
{
#if defined(WIN32)
m_addons_dir = m_user_config_dir+"../addons/";
#elif defined(__HAIKU__)
m_addons_dir = m_user_config_dir+"addons/";
#elif defined(__APPLE__)
m_addons_dir = getenv("HOME");
m_addons_dir += "/Library/Application Support/SuperTuxKart/Addons/";
@ -1179,7 +1182,7 @@ void FileManager::checkAndCreateReplayDir()
*/
void FileManager::checkAndCreateCachedTexturesDir()
{
#if defined(WIN32)
#if defined(WIN32) || defined(__HAIKU__)
m_cached_textures_dir = m_user_config_dir + "cached-textures/";
#elif defined(__APPLE__)
m_cached_textures_dir = getenv("HOME");