diff --git a/src/futils.cpp b/src/futils.cpp index 3e30c99..118d59c 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -51,6 +51,10 @@ namespace fs = std::experimental::filesystem; // clang-format on #endif +#if defined(__HAIKU__) +#include +#endif + #ifndef _MAX_PATH #define _MAX_PATH 1024 #endif @@ -366,6 +370,17 @@ std::string getProcessPath() { auto path = fs::path(pathbuf); #elif defined(__sun__) auto path = fs::read_symlink(Internal::stringFormat("/proc/%d/path/a.out", getpid())); +#elif defined(__HAIKU__) + int32 cookie = 0; + image_info info; + while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) + { + if (info.type == B_APP_IMAGE) + { + break; + } + } + auto path = fs::path(info.name); #elif defined(__unix__) auto path = fs::read_symlink("/proc/self/exe"); #endif