From 5938896afe87f30e3690ba7f917a75fadf79efba Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 9 Sep 2019 23:15:44 +1000
Subject: Set working directory


diff --git a/ball/main.c b/ball/main.c
index e7725e0..4b5dfb9 100644
--- a/ball/main.c
+++ b/ball/main.c
@@ -530,6 +530,12 @@ int main(int argc, char *argv[])
 {
     int t1, t0;
 
+#ifdef __HAIKU__
+	char *binpath = realpath(argv[0], NULL);
+	if (binpath != NULL)
+		argv[0] = strdup(binpath);
+#endif
+
     if (!fs_init(argc > 0 ? argv[0] : NULL))
     {
         fprintf(stderr, "Failure to initialize virtual file system (%s)\n",
diff --git a/putt/main.c b/putt/main.c
index 8202cfd..b1f45bf 100644
--- a/putt/main.c
+++ b/putt/main.c
@@ -289,6 +289,12 @@ int main(int argc, char *argv[])
 {
     int camera = 0;
 
+#ifdef __HAIKU__
+	char *binpath = realpath(argv[0], NULL);
+	if (binpath != NULL)
+		argv[0] = strdup(binpath);
+#endif
+
     if (!fs_init(argc > 0 ? argv[0] : NULL))
     {
         fprintf(stderr, "Failure to initialize virtual file system (%s)\n",
-- 
2.23.0

