Skip to content

Commit

Permalink
[Support] Implement getMainExecutable for Haiku
Browse files Browse the repository at this point in the history
This uses argv[0] on Haiku.
  • Loading branch information
brad0 committed Nov 24, 2023
1 parent d80e46d commit 579e721
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Support/Unix/Path.inc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const file_t kInvalidFile = -1;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
defined(__FreeBSD_kernel__) || defined(__linux__) || defined(__CYGWIN__) || \
defined(__DragonFly__) || defined(_AIX) || defined(__GNU__) || \
(defined(__sun__) && defined(__svr4__))
(defined(__sun__) && defined(__svr4__) || defined(__HAIKU__))
static int test_dir(char ret[PATH_MAX], const char *dir, const char *bin) {
struct stat sb;
char fullpath[PATH_MAX];
Expand Down Expand Up @@ -283,7 +283,7 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
// Fall back to the classical detection.
if (getprogpath(exe_path, argv0))
return exe_path;
#elif defined(__OpenBSD__)
#elif defined(__OpenBSD__) || defined(__HAIKU__)
char exe_path[PATH_MAX];
// argv[0] only
if (getprogpath(exe_path, argv0) != NULL)
Expand Down

0 comments on commit 579e721

Please sign in to comment.