Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icetime: Add proc_self_dirname for Haiku #338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions icetime/iceutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
# include <unistd.h>
#endif

#ifdef __HAIKU__
# include <image.h>
#endif

#if defined(__FreeBSD__) || defined(__NetBSD__)
# include <sys/sysctl.h>
#endif
Expand All @@ -51,6 +55,22 @@ std::string proc_self_dirname()
buflen--;
return std::string(path, buflen);
}
#elif defined(__HAIKU__)
std::string proc_self_dirname()
{
std::string path;

int32 cookie = 0;
image_info info;
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
if (info.type == B_APP_IMAGE) {
path.assign(info.name);
return path;
}
}
fprintf(stderr, "fatal error: unable to get self dirname!");
exit(EXIT_FAILURE);
}
#elif defined(__FreeBSD__) || defined(__NetBSD__)
std::string proc_self_dirname()
{
Expand Down