summaryrefslogtreecommitdiff
path: root/src/files.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2011-01-24 14:27:42 +0300
committerAndrey Nazarov <skuller@skuller.net>2011-01-25 15:20:05 +0300
commit61f5a9dbc5fd27d84f82491f5074bae2fe50426e (patch)
tree44d836c383c184f5da808aad728bcb145ceaea91 /src/files.c
parent294375c4aafabfbb339ef75f7c6e7ee0d052b446 (diff)
Re-exec ‘autoexec.cfg’ after gamedir change.
Restrict ‘config.cfg’ and ‘autoexec.cfg’ to be real files within the game directory, don't search for them in packs. Split Cmd_Exec_f into Cmd_ExecuteFile utility function. Add more validity checks: oversize names, oversize files, exec loops. Make Sys_AddDefaultConfig omit the ‘Execing...’ line if the config file is empty.
Diffstat (limited to 'src/files.c')
-rw-r--r--src/files.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/files.c b/src/files.c
index 0b3de80..d39d595 100644
--- a/src/files.c
+++ b/src/files.c
@@ -2952,6 +2952,7 @@ void FS_Shutdown( void ) {
// disconnected
static void fs_game_changed( cvar_t *self ) {
char *s = self->string;
+ qerror_t ret;
// validate it
if( *s ) {
@@ -2981,6 +2982,12 @@ static void fs_game_changed( cvar_t *self ) {
#else
FS_Restart( qfalse );
#endif
+
+ // exec autoexec.cfg (must be a real file within the game directory)
+ ret = Cmd_ExecuteFile( COM_AUTOEXECCFG_NAME, FS_TYPE_REAL|FS_PATH_GAME );
+ if( ret && ret != Q_ERR_NOENT ) {
+ Com_WPrintf( "Couldn't exec %s: %s\n", COM_AUTOEXECCFG_NAME, Q_ErrorString( ret ) );
+ }
}
/*