Don't create a cache if there were parsing errors.

Otherwise they will get lost, and may prevent any further start of the game.
This commit is contained in:
Guillaume Melquiond 2005-05-07 10:03:53 +00:00
parent 268b0c2779
commit eb7c9107f7

View file

@ -1252,16 +1252,17 @@ void game_controller::read_game_cfg(preproc_map& defines, config& cfg, bool use_
_("Warning: Errors occurred while loading game configuration files: '") +
error_log);
}
try {
scoped_ostream cache = ostream_file(fname);
write_compressed(*cache, cfg);
config checksum_cfg;
data_tree_checksum().write(checksum_cfg);
scoped_ostream checksum = ostream_file(fname_checksum);
write(*checksum, checksum_cfg);
} catch(io_exception&) {
std::cerr << "could not write to cache '" << fname << "'\n";
} else {
try {
scoped_ostream cache = ostream_file(fname);
write_compressed(*cache, cfg);
config checksum_cfg;
data_tree_checksum().write(checksum_cfg);
scoped_ostream checksum = ostream_file(fname_checksum);
write(*checksum, checksum_cfg);
} catch(io_exception&) {
std::cerr << "could not write to cache '" << fname << "'\n";
}
}
return;