mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- Fixed: Do not write the config file if DoGameSetup() has not been called yet.
SVN r3653 (trunk)
This commit is contained in:
parent
1389bc08ca
commit
d6cd9b430d
3 changed files with 14 additions and 1 deletions
|
@ -53,6 +53,7 @@ FConfigFile::FConfigFile ()
|
|||
LastSectionPtr = &Sections;
|
||||
CurrentEntry = NULL;
|
||||
PathName = "";
|
||||
OkayToWrite = true;
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
|
@ -70,6 +71,7 @@ FConfigFile::FConfigFile (const char *pathname,
|
|||
CurrentEntry = NULL;
|
||||
ChangePathName (pathname);
|
||||
LoadConfigFile (nosechandler, userdata);
|
||||
OkayToWrite = true;
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
|
@ -85,6 +87,7 @@ FConfigFile::FConfigFile (const FConfigFile &other)
|
|||
CurrentEntry = NULL;
|
||||
ChangePathName (other.PathName);
|
||||
*this = other;
|
||||
OkayToWrite = other.OkayToWrite;
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
|
@ -695,6 +698,12 @@ char *FConfigFile::ReadLine (char *string, int n, void *file) const
|
|||
|
||||
bool FConfigFile::WriteConfigFile () const
|
||||
{
|
||||
if (!OkayToWrite)
|
||||
{ // Pretend it was written anyway so that the user doesn't get
|
||||
// any "config not written" notifications.
|
||||
return true;
|
||||
}
|
||||
|
||||
FILE *file = fopen (PathName, "w");
|
||||
FConfigSection *section;
|
||||
FConfigEntry *entry;
|
||||
|
|
|
@ -79,6 +79,8 @@ protected:
|
|||
virtual char *ReadLine (char *string, int n, void *file) const;
|
||||
bool ReadConfig (void *file);
|
||||
|
||||
bool OkayToWrite;
|
||||
|
||||
private:
|
||||
struct FConfigEntry
|
||||
{
|
||||
|
|
|
@ -83,7 +83,8 @@ FGameConfigFile::FGameConfigFile ()
|
|||
FString user_docs, user_app_support, local_app_support;
|
||||
#endif
|
||||
FString pathname;
|
||||
|
||||
|
||||
OkayToWrite = false; // Do not allow saving of the config before DoGameSetup()
|
||||
bMigrating = false;
|
||||
pathname = GetConfigPath (true);
|
||||
ChangePathName (pathname);
|
||||
|
@ -441,6 +442,7 @@ void FGameConfigFile::DoGameSetup (const char *gamename)
|
|||
}
|
||||
}
|
||||
}
|
||||
OkayToWrite = true;
|
||||
}
|
||||
|
||||
void FGameConfigFile::ReadNetVars ()
|
||||
|
|
Loading…
Reference in a new issue