aboutsummaryrefslogtreecommitdiff
path: root/games/openarena/files/patch-feature-DEFAULT_LIBDIR
blob: 0e977835024f7b548d5222f7a306aac42af88710 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
--- code/qcommon/files.c.orig	2011-03-10 02:01:27.599036000 +0100
+++ code/qcommon/files.c	2011-03-19 22:40:42.000000000 +0100
@@ -250,6 +250,7 @@
 #endif
 
 static	cvar_t		*fs_basepath;
+static	cvar_t		*fs_libpath;
 static	cvar_t		*fs_basegame;
 static	cvar_t		*fs_gamedirvar;
 static	searchpath_t	*fs_searchpaths;
@@ -2956,6 +2957,7 @@
 	fs_debug = Cvar_Get( "fs_debug", "0", 0 );
 	fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT|CVAR_PROTECTED );
 	fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT );
+	fs_libpath = Cvar_Get ("fs_libpath", Sys_DefaultLibPath(), CVAR_INIT );
 	homePath = Sys_DefaultHomePath();
 	if (!homePath || !homePath[0]) {
 		homePath = fs_basepath->string;
@@ -2975,6 +2977,11 @@
 	if (fs_apppath->string[0])
 		FS_AddGameDirectory(fs_apppath->string, gameName);
 	#endif
+
+	// Search default library location if given
+	if (fs_libpath->string[0]) {
+		FS_AddGameDirectory ( fs_libpath->string, gameName );
+	}
 	
 	// NOTE: same filtering below for mods and basegame
 	if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
--- code/qcommon/qcommon.h.orig	2011-03-10 02:01:27.599036000 +0100
+++ code/qcommon/qcommon.h	2011-03-19 22:40:42.000000000 +0100
@@ -1104,6 +1104,9 @@
 char    *Sys_DefaultAppPath(void);
 #endif
 
+void	Sys_SetDefaultLibPath(const char *path);
+char	*Sys_DefaultLibPath(void);
+
 void  Sys_SetDefaultHomePath(const char *path);
 char	*Sys_DefaultHomePath(void);
 const char	*Sys_TempPath(void);
--- code/sys/sys_main.c.orig	2011-02-23 17:17:09.009063000 +0100
+++ code/sys/sys_main.c	2011-03-19 22:40:42.000000000 +0100
@@ -49,6 +49,7 @@
 
 static char binaryPath[ MAX_OSPATH ] = { 0 };
 static char installPath[ MAX_OSPATH ] = { 0 };
+static char libPath[ MAX_OSPATH ] = { 0 };
 
 /*
 =================
@@ -95,6 +96,29 @@
 
 /*
 =================
+Sys_SetDefaultLibPath
+=================
+*/
+void Sys_SetDefaultLibPath(const char *path)
+{
+	Q_strncpyz(libPath, path, sizeof(libPath));
+}
+
+/*
+=================
+Sys_DefaultLibPath
+=================
+*/
+char *Sys_DefaultLibPath(void)
+{
+	if (*libPath)
+		return libPath;
+	else
+		return Sys_Cwd();
+}
+
+/*
+=================
 Sys_DefaultAppPath
 =================
 */
@@ -490,6 +514,14 @@
 #	endif
 #endif
 
+#ifndef DEFAULT_LIBDIR
+#	ifdef MACOS_X
+#		define DEFAULT_LIBDIR Sys_StripAppBundle(Sys_BinaryPath())
+#	else
+#		define DEFAULT_LIBDIR Sys_BinaryPath()
+#	endif
+#endif
+
 /*
 =================
 Sys_SigHandler
@@ -564,6 +596,7 @@
 	Sys_ParseArgs( argc, argv );
 	Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) );
 	Sys_SetDefaultInstallPath( DEFAULT_BASEDIR );
+	Sys_SetDefaultLibPath( DEFAULT_LIBDIR );
 
 	// Concatenate the command line for passing to Com_Init
 	for( i = 1; i < argc; i++ )