- pass filename to I_WriteIniFailed as parameter.

This accessed game data from the backend.
This commit is contained in:
Christoph Oelckers 2022-10-02 14:08:07 +02:00
parent 34f30ee70b
commit 307ff4e163
4 changed files with 6 additions and 8 deletions

View file

@ -36,12 +36,11 @@
#include "cmdlib.h"
#include "i_system.h"
#include "gameconfigfile.h"
bool I_WriteIniFailed()
bool I_WriteIniFailed(const char * filename)
{
printf("The config file %s could not be saved:\n%s\n", GameConfig->GetPathName(), strerror(errno));
printf("The config file %s could not be saved:\n%s\n", filename, strerror(errno));
return false; // return true to retry
}

View file

@ -80,7 +80,6 @@
#include "i_input.h"
#include "c_dispatch.h"
#include "gameconfigfile.h"
#include "v_font.h"
#include "i_system.h"
#include "bitmap.h"
@ -764,7 +763,7 @@ void DestroyCustomCursor()
//
//==========================================================================
bool I_WriteIniFailed()
bool I_WriteIniFailed(const char* filename)
{
char *lpMsgBuf;
FString errortext;
@ -779,7 +778,7 @@ bool I_WriteIniFailed()
0,
NULL
);
errortext.Format ("The config file %s could not be written:\n%s", GameConfig->GetPathName(), lpMsgBuf);
errortext.Format ("The config file %s could not be written:\n%s", filename, lpMsgBuf);
LocalFree (lpMsgBuf);
return MessageBoxA(mainwindow.GetHandle(), errortext.GetChars(), GAMENAME " configuration not saved", MB_ICONEXCLAMATION | MB_RETRYCANCEL) == IDRETRY;
}

View file

@ -41,7 +41,7 @@ void I_SetIWADInfo ();
int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad);
// The ini could not be saved at exit
bool I_WriteIniFailed ();
bool I_WriteIniFailed (const char* filename);
// [RH] Checks the registry for Steam's install path, so we can scan its
// directories for IWADs if the user purchased any through Steam.

View file

@ -292,7 +292,7 @@ bool M_SaveDefaults (const char *filename)
void M_SaveDefaultsFinal ()
{
if (GameConfig == nullptr) return;
while (!M_SaveDefaults (nullptr) && I_WriteIniFailed ())
while (!M_SaveDefaults (nullptr) && I_WriteIniFailed (GameConfig->GetPathName()))
{
/* Loop until the config saves or I_WriteIniFailed() returns false */
}