mirror of https://github.com/YosysHQ/icestorm.git
icetime: Add proc_self_dirname for Haiku
This commit is contained in:
parent
738af82290
commit
af77423f39
|
|
@ -32,6 +32,10 @@
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
# include <image.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||||
# include <sys/sysctl.h>
|
# include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -51,6 +55,22 @@ std::string proc_self_dirname()
|
||||||
buflen--;
|
buflen--;
|
||||||
return std::string(path, 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__)
|
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||||
std::string proc_self_dirname()
|
std::string proc_self_dirname()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue