From 5f5775c1ec7bfeb6b0451fd5f9b11fb6c9974656 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 30 Dec 2010 19:50:58 -0500 Subject: [PATCH] Haiku fixes, merged from stable-2.0 branch. --- CMakeLists.txt | 7 +++++-- src/platform_beos.cpp | 18 +++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee7fc22e..2892249d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,9 @@ IF(BEOS) # We add this explicitly, since we don't want CMake to think this # is a C++ project unless we're on BeOS. SET(PHYSFS_BEOS_SRCS src/platform_beos.cpp) - SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} be root) + FIND_LIBRARY(BE_LIBRARY be) + FIND_LIBRARY(ROOT_LIBRARY root) + SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY}) ENDIF(BEOS) # Almost everything is "compiled" here, but things that don't apply to the @@ -334,7 +336,8 @@ IF(PHYSFS_BUILD_TEST) FIND_PATH(READLINE_H readline/readline.h) FIND_PATH(HISTORY_H readline/history.h) IF(READLINE_H AND HISTORY_H) - SET(CMAKE_REQUIRED_LIBRARIES curses) + FIND_LIBRARY(CURSES_LIBRARY NAMES curses ncurses) + SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY}) FIND_LIBRARY(READLINE_LIBRARY readline) FIND_LIBRARY(HISTORY_LIBRARY history) IF(READLINE_LIBRARY AND HISTORY_LIBRARY) diff --git a/src/platform_beos.cpp b/src/platform_beos.cpp index fa718895..aae29842 100644 --- a/src/platform_beos.cpp +++ b/src/platform_beos.cpp @@ -170,14 +170,18 @@ static team_id getTeamID(void) char *__PHYSFS_platformCalcBaseDir(const char *argv0) { - /* in case there isn't a BApplication yet, we'll construct a roster. */ - BRoster roster; - app_info info; - status_t rc = roster.GetRunningAppInfo(getTeamID(), &info); - BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL); - BEntry entry(&(info.ref), true); + image_info info; + int32 cookie = 0; + + while (get_next_image_info(0, &cookie, &info) == B_OK) + { + if (info.type == B_APP_IMAGE) + break; + } /* while */ + + BEntry entry(info.name, true); BPath path; - rc = entry.GetPath(&path); /* (path) now has binary's path. */ + status_t rc = entry.GetPath(&path); /* (path) now has binary's path. */ assert(rc == B_OK); rc = path.GetParent(&path); /* chop filename, keep directory. */ assert(rc == B_OK);