From: divverent Date: Fri, 28 Dec 2007 15:12:27 +0000 (+0000) Subject: extension to writeconfig command: also take a file name X-Git-Tag: xonotic-v0.1.0preview~2620 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fef15c9e3ce6b9d40fcbc4e4d8def5d63d16ac3e;p=xonotic%2Fdarkplaces.git extension to writeconfig command: also take a file name git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7874 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host.c b/host.c index 80e11e71..d9942831 100644 --- a/host.c +++ b/host.c @@ -197,7 +197,7 @@ void Host_SaveConfig_f(void); void Host_LoadConfig_f(void); static void Host_InitLocal (void) { - Cmd_AddCommand("saveconfig", Host_SaveConfig_f, "save settings to config.cfg immediately (also automatic when quitting)"); + Cmd_AddCommand("saveconfig", Host_SaveConfig_f, "save settings to config.cfg (or a specified filename) immediately (also automatic when quitting)"); Cmd_AddCommand("loadconfig", Host_LoadConfig_f, "reset everything and reload configs"); Cvar_RegisterVariable (&host_framerate); @@ -223,13 +223,19 @@ Writes key bindings and archived cvars to config.cfg void Host_SaveConfig_f(void) { qfile_t *f; + char *file = "config.cfg"; + + if(Cmd_Argc() >= 2) { + file = Cmd_Argv(1); + Con_Printf("Saving to %s\n", file); + } // dedicated servers initialize the host but don't parse and set the // config.cfg cvars // LordHavoc: don't save a config if it crashed in startup if (host_framecount >= 3 && cls.state != ca_dedicated && !COM_CheckParm("-benchmark") && !COM_CheckParm("-capturedemo")) { - f = FS_Open ("config.cfg", "wb", false, false); + f = FS_Open (file, "wb", false, false); if (!f) { Con_Print("Couldn't write config.cfg.\n");