about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDominik Geyer <dominik.geyer@gmx.de>2008-10-01 18:23:49 +0000
committerDominik Geyer <dominik.geyer@gmx.de>2008-10-01 18:23:49 +0000
commiteb983a644626b40f5764e4fa2d3052e616f2d035 (patch)
tree716e3f8042e6fd3344973cb48e66e7aa6936e34a
parent965f5d590d5435e0cc70695df741e5d67b6491b1 (diff)
downloadzcatch-eb983a644626b40f5764e4fa2d3052e616f2d035.tar.gz
zcatch-eb983a644626b40f5764e4fa2d3052e616f2d035.zip
use same detection flow of data-dir on all platforms
-rw-r--r--src/engine/e_engine.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/engine/e_engine.c b/src/engine/e_engine.c
index a27ab539..c8a1b07b 100644
--- a/src/engine/e_engine.c
+++ b/src/engine/e_engine.c
@@ -416,14 +416,6 @@ void engine_hostlookup(HOSTLOOKUP *lookup, const char *hostname)
 
 int engine_chdir_datadir(char *argv0)
 {
-#if defined(CONF_FAMILY_UNIX)
-	static const char *sdirs[] = {
-		"/usr/share/teeworlds",
-		"/usr/local/share/teeworlds"
-	};
-	static const int sdirs_count = sizeof(sdirs) / sizeof(sdirs[0]);
-#endif
-
 	int found = 0;
 	char data_dir[1024*2];
 	
@@ -445,7 +437,6 @@ int engine_chdir_datadir(char *argv0)
 		}
 	}
 	
-#if defined(CONF_FAMILY_UNIX)
 	/* 2) use data-dir in PWD if present */
 	if (!found && fs_is_dir("data"))
 	{
@@ -477,10 +468,17 @@ int engine_chdir_datadir(char *argv0)
 				found = 1;
 		}
 	}
-
+	
+#if defined(CONF_FAMILY_UNIX)
 	/* 5) check for all default locations */
 	if (!found)
 	{
+		const char *sdirs[] = {
+			"/usr/share/teeworlds",
+			"/usr/local/share/teeworlds"
+		};
+		const int sdirs_count = sizeof(sdirs) / sizeof(sdirs[0]);
+		
 		int i;
 		for (i = 0; i < sdirs_count; i++)
 		{
@@ -492,15 +490,9 @@ int engine_chdir_datadir(char *argv0)
 			}
 		}
 	}
-#elif defined(CONF_FAMILY_WINDOWS)
-	/* FIXME: any alternative directories to search? %PROGRAM_FILES%/.../ */
-	if (!found && fs_is_dir("data"))
-	{
-		strcpy(data_dir, "data");
-		found = 1;
-	}
 #endif
 	
+	/* data-dir exists */
 	if (found)
 	{
 		dbg_msg("engine/datadir", "using '%s'", data_dir);