From aa7a6ad417dfd0499380cc2c0f426022928e7afe Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Fri, 3 Jan 2020 12:18:18 +0100
Subject: Fix launch from Tracker and Deskbar


diff --git a/src/main.cpp b/src/main.cpp
index dc75c72..86ba129 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -29,10 +29,20 @@ using std::string;
 #include <vector>
 using std::vector;
 
+#ifdef __HAIKU__
+#include <libgen.h>
+#include <unistd.h>
+#endif
+
 const string VERSION = "0.1.9";
 
 int main(int argc, char** argv)
 {
+	char *binpath = realpath(argv[0], NULL);
+	if (binpath != NULL) {
+		chdir(dirname(binpath));
+		free(binpath);
+	}
 	srand(time(null));
 	int screenWidth = 640, screenHeight = 480;
 	bool fullscreen = false, centered=false;
-- 
2.24.1

