Skip to content

Commit

Permalink
de::Config: Previous version kept available for upgrading
Browse files Browse the repository at this point in the history
When a new version is detected, the old config is read and its version
is stored as '__oldversion__' so that the re-run config script can
modify the values as necessary.
  • Loading branch information
skyjake committed Jul 19, 2012
1 parent d098ee8 commit ae347f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion doomsday/libdeng2/src/core/config.cpp
Expand Up @@ -64,12 +64,17 @@ void Config::read()

// If the saved config is from a different version, rerun the script.
// Otherwise, we're done.
if(!names()["__version__"].value().compare(*version))
const Value& oldVersion = names()["__version__"].value();
if(!oldVersion.compare(*version))
{
// Versions match.
LOG_MSG("") << _writtenConfigPath << " matches version " << version->asText();
return;
}

// Version mismatch: store the old version in a separate variable.
_config.globals().add(new Variable("__oldversion__", oldVersion.duplicate(),
Variable::AllowArray | Variable::ReadOnly));
}
catch(const Folder::NotFoundError&)
{
Expand Down

0 comments on commit ae347f9

Please sign in to comment.