aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Noble2002-05-12 21:59:03 +0000
committerNicolas Noble2002-05-12 21:59:03 +0000
commitb17a510c2444623c980155c14b9bfb3a9d870d6f (patch)
treec4dd6de3e2047d2fdb97df1a8588598c8d4b7951
parente902309d30d654ec3290cf54529789710b735f73 (diff)
downloadscummvm-rg350-b17a510c2444623c980155c14b9bfb3a9d870d6f.tar.gz
scummvm-rg350-b17a510c2444623c980155c14b9bfb3a9d870d6f.tar.bz2
scummvm-rg350-b17a510c2444623c980155c14b9bfb3a9d870d6f.zip
Almost closing bug #555105 (waiting for confirmation...)
svn-id: r4301
-rw-r--r--config-file.cpp9
-rw-r--r--config-file.h2
-rw-r--r--gameDetector.cpp3
3 files changed, 12 insertions, 2 deletions
diff --git a/config-file.cpp b/config-file.cpp
index c753f8dadd..d7e77bcb8b 100644
--- a/config-file.cpp
+++ b/config-file.cpp
@@ -155,7 +155,7 @@ void hashconfig::merge(const hashconfig * h)
// The config-class itself.
Config::Config(const char *cfg, const char *d)
- : filename(Scumm::Strdup(cfg)), domain(d ? Scumm::Strdup(d) : 0), hash(0), ndomains(0)
+ : filename(Scumm::Strdup(cfg)), domain(d ? Scumm::Strdup(d) : 0), hash(0), ndomains(0), willwrite(false)
{
FILE *cfg_file;
char t[MAXLINELEN];
@@ -302,6 +302,9 @@ void Config::flush() const
{
FILE *cfg_file;
int i;
+
+ if (!willwrite)
+ return;
if (!(cfg_file = fopen(filename, "w"))) {
debug(1, "Unable to write configuration file: %s.\n", filename);
@@ -377,3 +380,7 @@ void Config::merge_config(const Config * c)
}
}
}
+
+void Config::set_writing(bool w) {
+ willwrite = w;
+}
diff --git a/config-file.h b/config-file.h
index 922724cce4..2e2f20477b 100644
--- a/config-file.h
+++ b/config-file.h
@@ -38,10 +38,12 @@ class Config {
void delete_domain(const char *);
void change_filename(const char *);
void merge_config(const Config *);
+ void set_writing(bool);
private:
char * filename, * domain;
hashconfig ** hash;
int ndomains;
+ bool willwrite;
};
// The global config object
diff --git a/gameDetector.cpp b/gameDetector.cpp
index 3b7651720a..bad009effb 100644
--- a/gameDetector.cpp
+++ b/gameDetector.cpp
@@ -230,6 +230,7 @@ void GameDetector::parseCommandLine(int argc, char **argv)
exit(1);
case 'w':
_saveconfig = true;
+ scummcfg->set_writing(true);
HANDLE_OPT_OPTION();
if (option != NULL)
scummcfg->change_filename(option);
@@ -258,7 +259,7 @@ void GameDetector::parseCommandLine(int argc, char **argv)
}
}
- if (_saveconfig)
+ if (_exe_name)
scummcfg->flush();
return;