From: molivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sun, 25 Jun 2006 17:35:17 +0000 (+0000)
Subject: You can now set a different default base directory at compile time, by defining DP_FS... 
X-Git-Tag: xonotic-v0.1.0preview~3892
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1d1828cc5ff2288943b8f00a050d46a28597bb8b;p=xonotic%2Fdarkplaces.git

You can now set a different default base directory at compile time, by defining DP_FS_BASEDIR to the new value (ex: make DP_FS_BASEDIR=/usr/local/games/quake release)


git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6486 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/fs.c b/fs.c
index bf4c3c6d..f982e226 100644
--- a/fs.c
+++ b/fs.c
@@ -1061,9 +1061,15 @@ void FS_Init (void)
 
 	fs_mempool = Mem_AllocPool("file management", 0, NULL);
 
-	strcpy(fs_basedir, "");
 	strcpy(fs_gamedir, "");
 
+// If the base directory is explicitly defined by the compilation process
+#ifdef DP_FS_BASEDIR
+	strcpy(fs_basedir, DP_FS_BASEDIR);
+
+#else
+	strcpy(fs_basedir, "");
+
 #ifdef MACOSX
 	// FIXME: is there a better way to find the directory outside the .app?
 	if (strstr(com_argv[0], ".app/"))
@@ -1076,6 +1082,7 @@ void FS_Init (void)
 		strlcpy(fs_basedir, com_argv[0], sizeof(fs_basedir));
 		fs_basedir[split - com_argv[0]] = 0;
 	}
+#endif
 #endif
 
 	PK3_OpenLibrary ();
diff --git a/makefile.inc b/makefile.inc
index ee659eb8..e6dd4f1f 100644
--- a/makefile.inc
+++ b/makefile.inc
@@ -18,6 +18,8 @@ CPUOPTIMIZATIONS=
 
 SDL_CONFIG?=sdl-config
 
+DP_FS_BASEDIR?=
+
 
 ###### Sound and audio CD #####
 
@@ -56,7 +58,6 @@ OBJ_NOCD=cd_null.o
 
 # Common objects
 OBJ_COMMON= \
-	libcurl.o \
 	cd_shared.o \
 	cl_collision.o \
 	cl_demo.o \
@@ -90,6 +91,7 @@ OBJ_COMMON= \
 	jpeg.o \
 	keys.o \
 	lhnet.o \
+	libcurl.o \
 	mathlib.o \
 	matrixlib.o \
 	mdfour.o \
@@ -138,8 +140,7 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $(
 
 
 # Compilation
-# CFLAGS_COMMON=-MD -Wall -Werror
-CFLAGS_COMMON=$(CFLAGS_MAKEDEP) -Wall -Wsign-compare
+CFLAGS_COMMON=$(CFLAGS_MAKEDEP) -DDP_FS_BASEDIR=\"$(DP_FS_BASEDIR)\" -Wall -Wsign-compare
 CFLAGS_DEBUG=-ggdb
 CFLAGS_PROFILE=-g -pg -ggdb
 CFLAGS_RELEASE=