diff --git a/client/cl_main.c b/client/cl_main.c index 9dcf942..9e1bf1c 100644 --- a/client/cl_main.c +++ b/client/cl_main.c @@ -1741,13 +1741,16 @@ CL_WriteConfiguration Writes key bindings and archived cvars to config.cfg =============== */ -void CL_WriteConfiguration (char *cfgName) +qboolean CL_WriteConfiguration (char *cfgName) { FILE *f; char path[MAX_QPATH]; + if (!cfgName) + return false; + if (cls.state == ca_uninitialized) - return; + return false; // Knightmare changed- use separate config for better cohabitation //Com_sprintf (path, sizeof(path),"%s/config.cfg",FS_Gamedir()); @@ -1759,7 +1762,7 @@ void CL_WriteConfiguration (char *cfgName) //Com_Printf ("Couldn't write config.cfg.\n"); // Com_Printf ("Couldn't write kmq2config.cfg.\n"); Com_Printf ("Couldn't write %s.cfg.\n", cfgName); - return; + return false; } fprintf (f, "// This file is generated by KMQuake2, do not modify.\n"); @@ -1768,6 +1771,8 @@ void CL_WriteConfiguration (char *cfgName) fclose (f); Cvar_WriteVariables (path); + + return true; } @@ -1788,8 +1793,8 @@ void CL_WriteConfig_f (void) else // if (Cmd_Argc() == 2) strncpy (cfgName, Cmd_Argv(1), sizeof(cfgName)); - CL_WriteConfiguration (cfgName); - Com_Printf ("Wrote config file %s/%s.cfg.\n", FS_Gamedir(), cfgName); + if (CL_WriteConfiguration (cfgName)) + Com_Printf ("Wrote config file %s/%s.cfg.\n", FS_Gamedir(), cfgName); } else Com_Printf ("Usage: writeconfig \n");