Skip to content

Commit 78832fe

Browse files
committed
implement Path::getCurrentExecutablePath for Haiku
1 parent 86f4c91 commit 78832fe

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/path.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
#if defined(__APPLE__)
5353
#include <mach-o/dyld.h>
5454
#endif
55+
#if defined(__HAIKU__)
56+
#include <image.h>
57+
#endif
5558

5659

5760
/** Is the filesystem case insensitive? */
@@ -158,6 +161,17 @@ std::string Path::getCurrentExecutablePath(const char* fallback)
158161
#elif defined(__APPLE__)
159162
uint32_t size = sizeof(buf);
160163
success = (_NSGetExecutablePath(buf, &size) == 0);
164+
#elif defined(__HAIKU__)
165+
int32 cookie = 0;
166+
image_info info;
167+
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK)
168+
{
169+
if (info.type == B_APP_IMAGE)
170+
{
171+
break;
172+
}
173+
}
174+
return std::string(info.name);
161175
#else
162176
const char* procPath =
163177
#ifdef __SVR4 // Solaris

0 commit comments

Comments
 (0)