Skip to content

Commit fcf2e8c

Browse files
committed
Haiku: Add minipal_getexepath implementation
1 parent 4bfdd53 commit fcf2e8c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/native/minipal/getexepath.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#include <sys/sysctl.h>
1818
#elif defined(_WIN32)
1919
#include <windows.h>
20+
#elif defined(__HAIKU__)
21+
#include <FindDirectory.h>
22+
#include <StorageDefs.h>
2023
#elif HAVE_GETAUXVAL
2124
#include <sys/auxv.h>
2225
#endif
@@ -61,6 +64,16 @@ static inline char* minipal_getexepath(void)
6164
return NULL;
6265
}
6366

67+
return realpath(path, NULL);
68+
#elif defined(__HAIKU__)
69+
char path[B_PATH_NAME_LENGTH];
70+
status_t status = find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH, NULL, path, B_PATH_NAME_LENGTH);
71+
if (status != B_OK)
72+
{
73+
errno = status;
74+
return NULL;
75+
}
76+
6477
return realpath(path, NULL);
6578
#elif defined(_WIN32)
6679
char path[MAX_PATH];

0 commit comments

Comments
 (0)