mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 13:41:05 +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;
|
LastSectionPtr = &Sections;
|
||||||
CurrentEntry = NULL;
|
CurrentEntry = NULL;
|
||||||
PathName = "";
|
PathName = "";
|
||||||
|
OkayToWrite = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
@ -70,6 +71,7 @@ FConfigFile::FConfigFile (const char *pathname,
|
||||||
CurrentEntry = NULL;
|
CurrentEntry = NULL;
|
||||||
ChangePathName (pathname);
|
ChangePathName (pathname);
|
||||||
LoadConfigFile (nosechandler, userdata);
|
LoadConfigFile (nosechandler, userdata);
|
||||||
|
OkayToWrite = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
@ -85,6 +87,7 @@ FConfigFile::FConfigFile (const FConfigFile &other)
|
||||||
CurrentEntry = NULL;
|
CurrentEntry = NULL;
|
||||||
ChangePathName (other.PathName);
|
ChangePathName (other.PathName);
|
||||||
*this = other;
|
*this = other;
|
||||||
|
OkayToWrite = other.OkayToWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
@ -695,6 +698,12 @@ char *FConfigFile::ReadLine (char *string, int n, void *file) const
|
||||||
|
|
||||||
bool FConfigFile::WriteConfigFile () 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");
|
FILE *file = fopen (PathName, "w");
|
||||||
FConfigSection *section;
|
FConfigSection *section;
|
||||||
FConfigEntry *entry;
|
FConfigEntry *entry;
|
||||||
|
|
|
@ -79,6 +79,8 @@ protected:
|
||||||
virtual char *ReadLine (char *string, int n, void *file) const;
|
virtual char *ReadLine (char *string, int n, void *file) const;
|
||||||
bool ReadConfig (void *file);
|
bool ReadConfig (void *file);
|
||||||
|
|
||||||
|
bool OkayToWrite;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct FConfigEntry
|
struct FConfigEntry
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,6 +84,7 @@ FGameConfigFile::FGameConfigFile ()
|
||||||
#endif
|
#endif
|
||||||
FString pathname;
|
FString pathname;
|
||||||
|
|
||||||
|
OkayToWrite = false; // Do not allow saving of the config before DoGameSetup()
|
||||||
bMigrating = false;
|
bMigrating = false;
|
||||||
pathname = GetConfigPath (true);
|
pathname = GetConfigPath (true);
|
||||||
ChangePathName (pathname);
|
ChangePathName (pathname);
|
||||||
|
@ -441,6 +442,7 @@ void FGameConfigFile::DoGameSetup (const char *gamename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OkayToWrite = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGameConfigFile::ReadNetVars ()
|
void FGameConfigFile::ReadNetVars ()
|
||||||
|
|
Loading…
Reference in a new issue