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
1 changed files with 3 additions and 14 deletions

View File

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