From: bones_was_here Date: Tue, 2 Jan 2024 13:21:15 +0000 (+1000) Subject: host: log graceful shutdown (config, history) X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6d7ce4397972f050c17b11de2f75209bdd562b80;p=xonotic%2Fdarkplaces.git host: log graceful shutdown (config, history) Stopping demo recording should already get a message. Signed-off-by: bones_was_here --- diff --git a/host.c b/host.c index fdfb6836..4d272e36 100644 --- a/host.c +++ b/host.c @@ -202,9 +202,11 @@ void Host_SaveConfig(const char *file) f = FS_OpenRealFile(file, "wb", false); if (!f) { - Con_Printf(CON_ERROR "Couldn't write %s.\n", file); + Con_Printf(CON_ERROR "Couldn't write %s\n", file); return; } + else + Con_Printf("Saving config to %s ...\n", file); Key_WriteBindings (f); Cvar_WriteVariables (&cvars_all, f); @@ -217,10 +219,8 @@ static void Host_SaveConfig_f(cmd_state_t *cmd) { const char *file = CONFIGFILENAME; - if(Cmd_Argc(cmd) >= 2) { + if(Cmd_Argc(cmd) >= 2) file = Cmd_Argv(cmd, 1); - Con_Printf("Saving to %s\n", file); - } Host_SaveConfig(file); } @@ -581,12 +581,12 @@ void Host_Shutdown(void) if (isdown) { - Con_Print("recursive shutdown\n"); + Con_Print(CON_WARN "recursive shutdown\n"); return; } if (setjmp(host.abortframe)) { - Con_Print("aborted the quitting frame?!?\n"); + Con_Print(CON_WARN "aborted the quitting frame?!?\n"); return; } isdown = true; diff --git a/keys.c b/keys.c index 4d7ed174..fae46452 100644 --- a/keys.c +++ b/keys.c @@ -92,18 +92,20 @@ static void Key_History_Init(void) static void Key_History_Shutdown(void) { - // TODO write history to a file - // not necessary for mobile #ifndef DP_MOBILETOUCH qfile_t *historyfile = FS_OpenRealFile("darkplaces_history.txt", "w", false); if(historyfile) { int i; + + Con_Print("Saving command history to darkplaces_history.txt ...\n"); for(i = 0; i < CONBUFFER_LINES_COUNT(&history); ++i) FS_Printf(historyfile, "%s\n", ConBuffer_GetLine(&history, i)); FS_Close(historyfile); } + else + Con_Print(CON_ERROR "Couldn't write darkplaces_history.txt\n"); #endif ConBuffer_Shutdown(&history);