add fs_usercfg. defaults to "" (nothing) in oldstyle, or "~/.PACKAGErc" in

newstyle.
This commit is contained in:
Bill Currie 2001-02-10 00:40:55 +00:00
parent 4eb41da471
commit 0ffba7e3da
7 changed files with 46 additions and 7 deletions

View File

@ -19,6 +19,9 @@
/* Define this to the location of the global config file */
#undef FS_GLOBALCFG
/* Define this to the location of the user config file */
#undef FS_USERCFG
/* Define this to the shared game directory root */
#undef FS_SHAREPATH

View File

@ -1038,6 +1038,7 @@ if test "x$newstyle" = xyes -o "x$newstyle" = "x"; then
AC_DEFINE(BASEGAME, "base")
AC_DEFINE(SKINBASE, "base")
default_globalconf="/etc/$PACKAGE.conf"
default_userconf="~/.${PACKAGE}rc"
eval foo="$datadir"
default_sharepath="$foo/games/$PACKAGE"
default_userpath="~/.$PACKAGE"
@ -1047,8 +1048,10 @@ else
AC_DEFINE(SKINBASE, "qw")
if test "x$SYSTYPE" = xWIN32; then
default_globalconf="%WINDIR%/$PACKAGE.conf"
default_userconf=""
else
default_globalconf="/etc/$PACKAGE.conf"
default_userconf=""
fi
default_sharepath="."
default_userpath="."
@ -1065,6 +1068,17 @@ if test "x$globalconf" = "xauto" || test "x$globalconf" = "xyes" || \
fi
AC_DEFINE_UNQUOTED(FS_GLOBALCFG, "$globalconf")
AC_ARG_WITH(user-cfg,
[ --with-user-cfg=FILE If set will change the name and location of the
global config file used by QuakeForge. Defaults to
/etc/quakeforge.conf.],
globalconf="$withval", userconf="auto")
if test "x$userconf" = "xauto" || test "x$userconf" = "xyes" || \
test "x$userconf" = "xno"; then dnl yes/no sanity checks
userconf="$default_userconf"
fi
AC_DEFINE_UNQUOTED(FS_USERCFG, "$userconf")
AC_ARG_WITH(sharepath,
[ --with-sharepath=DIR Use DIR for shared game data, defaults to
'.' or \${datadir}/games/quakeforge (if new style)],
@ -1416,6 +1430,7 @@ AC_MSG_RESULT([
Shared game data directory: $sharepath
Per-user game data directory: $userpath
Global configuration file: $globalconf
User configuration file: $userconf
])
if test -d $srcdir/CVS; then
echo "WARNING: Hackers at work, watch for falling bits of code."

View File

@ -268,6 +268,9 @@
/* Location of QuakeForge's global config file */
#define FS_GLOBALCFG "./quakeforge.conf"
/* Location of QuakeForge's user config file */
#define FS_USERCFG ""
//#define strcasecmp(s1, s2) stricmp((s1), (s2))
//#define strncasecmp(s1, s2, n) strnicmp((s1), (s2), (n))

View File

@ -290,6 +290,9 @@
/* Location of QuakeForge's global config file */
#define FS_GLOBALCFG "~/quakeforge.conf"
/* Location of QuakeForge's user config file */
#define FS_USERCFG ""
#define strcasecmp(s1, s2) stricmp((s1), (s2))
#define strncasecmp(s1, s2, n) strnicmp((s1), (s2), (n))

View File

@ -105,6 +105,7 @@ qboolean noclip_anglehack; // remnant from old quake
cvar_t *fs_globalcfg;
cvar_t *fs_usercfg;
cvar_t *rcon_password;
cvar_t *rcon_address;
@ -1561,6 +1562,15 @@ Host_Init (void)
Cmd_StuffCmds_f ();
Cbuf_Execute_Sets ();
fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG,
CVAR_ROM, "user configuration file");
Cmd_Exec_File (fs_usercfg->string);
Cbuf_Execute_Sets ();
// execute +set again to override the config file
Cmd_StuffCmds_f ();
Cbuf_Execute_Sets ();
CL_Cam_Init_Cvars ();
CL_Input_Init_Cvars ();
Skin_Init_Cvars ();

View File

@ -303,24 +303,18 @@ void
Cmd_Exec_File (char *path)
{
char *f;
int mark;
int len;
char base[32];
QFile *file;
if ((file = Qopen (path, "r")) != NULL) {
// extract the filename base name for hunk tag
COM_FileBase (path, base);
len = COM_filelength (file);
mark = Hunk_LowMark ();
f = (char *) Hunk_AllocName (len + 1, base);
f = (char *) Hunk_TempAlloc (len + 1);
if (f) {
f[len] = 0;
Qread (file, f, len);
Qclose (file);
Cbuf_InsertText (f);
}
Hunk_FreeToLowMark (mark);
}
}

View File

@ -80,6 +80,7 @@ cvar_t *sv_allow_log;
cvar_t *sv_allow_ping;
cvar_t *fs_globalcfg;
cvar_t *fs_usercfg;
cvar_t *sv_mintic; // bound the size of the
cvar_t *sv_maxtic; // physics time tic
@ -1900,6 +1901,16 @@ SV_Init (void)
Cmd_StuffCmds_f ();
Cbuf_Execute_Sets ();
fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG,
CVAR_ROM, "user configuration file");
Cmd_Exec_File (fs_usercfg->string);
Cbuf_Execute_Sets ();
// execute +set again to override the config file
Cmd_StuffCmds_f ();
Cbuf_Execute_Sets ();
COM_Filesystem_Init_Cvars ();
COM_Init_Cvars ();
Mod_Init_Cvars ();