From 61f5a9dbc5fd27d84f82491f5074bae2fe50426e Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Mon, 24 Jan 2011 14:27:42 +0300 Subject: Re-exec ‘autoexec.cfg’ after gamedir change. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/files.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/files.c') 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 ) ); + } } /* -- cgit v1.2.3