Skip to content

Commit 579e721

Browse files
committed
[Support] Implement getMainExecutable for Haiku
This uses argv[0] on Haiku.
1 parent d80e46d commit 579e721

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Support/Unix/Path.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const file_t kInvalidFile = -1;
129129
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
130130
defined(__FreeBSD_kernel__) || defined(__linux__) || defined(__CYGWIN__) || \
131131
defined(__DragonFly__) || defined(_AIX) || defined(__GNU__) || \
132-
(defined(__sun__) && defined(__svr4__))
132+
(defined(__sun__) && defined(__svr4__) || defined(__HAIKU__))
133133
static int test_dir(char ret[PATH_MAX], const char *dir, const char *bin) {
134134
struct stat sb;
135135
char fullpath[PATH_MAX];
@@ -283,7 +283,7 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
283283
// Fall back to the classical detection.
284284
if (getprogpath(exe_path, argv0))
285285
return exe_path;
286-
#elif defined(__OpenBSD__)
286+
#elif defined(__OpenBSD__) || defined(__HAIKU__)
287287
char exe_path[PATH_MAX];
288288
// argv[0] only
289289
if (getprogpath(exe_path, argv0) != NULL)

0 commit comments

Comments
 (0)