Haiku support, code simplification.

using more straightforward approach to get the current binary path.
Actual approach more fit to get other infos (e.g. address mappings and so on).
This commit is contained in:
David Carlier 2020-09-01 11:27:26 +00:00
parent 56ddda7021
commit e4fac541a9

View file

@ -46,7 +46,7 @@
#endif #endif
#ifdef __HAIKU__ #ifdef __HAIKU__
#include <kernel/image.h> #include <FindDirectory.h>
#endif #endif
#ifndef PATH_MAX #ifndef PATH_MAX
@ -123,20 +123,9 @@ static void SetExecutablePath(char* exePath)
// TODO: realpath() ? // TODO: realpath() ?
// TODO: no idea what this is if the executable is in an app bundle // TODO: no idea what this is if the executable is in an app bundle
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
image_info ii; if (find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH, NULL, exePath, PATH_MAX) != B_OK)
int32_t id = 0;
exePath[0] = '\0';
for (; get_next_image_info(0, &id, &ii) == B_OK;)
{ {
if (ii.type == B_APP_IMAGE) exePath[0] = '\0';
break;
}
if (ii.type == B_APP_IMAGE)
{
Q_strlcpy(exePath, ii.name, PATH_MAX);
} }
#else #else