diff --git a/src/configfile.cpp b/src/configfile.cpp index b379bcf2a..fcbed42c3 100644 --- a/src/configfile.cpp +++ b/src/configfile.cpp @@ -54,6 +54,7 @@ FConfigFile::FConfigFile () CurrentEntry = NULL; PathName = ""; OkayToWrite = true; + FileExisted = true; } //==================================================================== @@ -72,6 +73,7 @@ FConfigFile::FConfigFile (const char *pathname, ChangePathName (pathname); LoadConfigFile (nosechandler, userdata); OkayToWrite = true; + FileExisted = true; } //==================================================================== @@ -88,6 +90,7 @@ FConfigFile::FConfigFile (const FConfigFile &other) ChangePathName (other.PathName); *this = other; OkayToWrite = other.OkayToWrite; + FileExisted = other.FileExisted; } //==================================================================== @@ -590,11 +593,15 @@ void FConfigFile::LoadConfigFile (void (*nosechandler)(const char *pathname, FCo FILE *file = fopen (PathName, "r"); bool succ; + FileExisted = false; if (file == NULL) + { return; + } succ = ReadConfig (file); fclose (file); + FileExisted = succ; if (!succ) { // First valid line did not define a section @@ -698,9 +705,10 @@ char *FConfigFile::ReadLine (char *string, int n, void *file) const bool FConfigFile::WriteConfigFile () const { - if (!OkayToWrite) + if (!OkayToWrite && FileExisted) { // Pretend it was written anyway so that the user doesn't get - // any "config not written" notifications. + // any "config not written" notifications, but only if the file + // already existed. Otherwise, let it write out a default one. return true; } diff --git a/src/configfile.h b/src/configfile.h index 173d6fede..b704dd359 100644 --- a/src/configfile.h +++ b/src/configfile.h @@ -80,6 +80,7 @@ protected: bool ReadConfig (void *file); bool OkayToWrite; + bool FileExisted; private: struct FConfigEntry diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 0bad0c3ed..be4e5873e 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -326,7 +326,7 @@ int FIWadManager::CheckIWAD (const char *doomwaddir, WadStuff *wads) int numfound; numfound = 0; - +return 0; slash = (doomwaddir[0] && doomwaddir[strlen (doomwaddir)-1] != '/') ? "/" : ""; // Search for a pre-defined IWAD