From 1989e5b49aa41dee60c76b0951fea2dd8b1b2251 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 12 Jan 2014 21:32:19 +0100
Subject: Look for the datafile next to the executable.

XRick can be run from Deskbar or Tracker this way.

diff --git a/src/xrick.c b/src/xrick.c
index 38d4e26..870adc7 100644
--- a/src/xrick.c
+++ b/src/xrick.c
@@ -25,8 +25,13 @@ main(int argc, char *argv[])
 	sys_init(argc, argv);
 	if (sysarg_args_data)
 		data_setpath(sysarg_args_data);
-	else
-		data_setpath("data.zip");
+	else {
+		const char* basename = dirname(argv[0]);
+		char* datapath = malloc(strlen(basename) + strlen("/data.zip") + 1);
+		strcpy(datapath, basename);
+		strcat(datapath, "/data.zip");
+		data_setpath(datapath);
+	}
 	game_run();
 	data_closepath();
 	sys_shutdown();
-- 
1.8.3.4

