Skip to content

Commit

Permalink
libdeng2|Config: Don't warn about missing version info in serialized …
Browse files Browse the repository at this point in the history
…data

The version information can be missing under some circumstances
(first run, etc.).
  • Loading branch information
skyjake committed Mar 8, 2014
1 parent c34a687 commit 203d1bd
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions doomsday/libdeng2/src/core/config.cpp
Expand Up @@ -93,19 +93,27 @@ void Config::read()
LOG_DEBUG("Found serialized Config:\n") << names();

// If the saved config is from a different version, rerun the script.
Value const &oldVersion = names()["__version__"].value();
d->setOldVersion(oldVersion);
if(oldVersion.compare(*version))
if(names().has("__version__"))
{
// Version mismatch: store the old version in a separate variable.
d->config.globals().add(new Variable("__oldversion__", oldVersion.duplicate(),
Value const &oldVersion = names()["__version__"].value();
d->setOldVersion(oldVersion);
if(oldVersion.compare(*version))
{
// Version mismatch: store the old version in a separate variable.
d->config.globals().add(new Variable("__oldversion__", oldVersion.duplicate(),
Variable::AllowArray | Variable::ReadOnly));
shouldRunScript = true;
shouldRunScript = true;
}
else
{
// Versions match.
LOG_MSG("") << d->refuge.path() << " matches version " << version->asText();
}
}
else
{
// Versions match.
LOG_MSG("") << d->refuge.path() << " matches version " << version->asText();
// Don't know what version this is, run script to be sure.
shouldRunScript = true;
}

// Also check the timestamp of written config vs. the config script.
Expand Down

0 comments on commit 203d1bd

Please sign in to comment.