mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 12:22:33 +00:00
Cache the config cache files prefix
No pun intended. This micro-refactoring step will be required for introducing functionality that requires to know the config cache files' naming pattern.
This commit is contained in:
parent
2415df79b8
commit
8601c79647
@ -48,8 +48,15 @@ namespace game_config {
|
||||
force_valid_cache_(false),
|
||||
use_cache_(true),
|
||||
fake_invalid_cache_(false),
|
||||
defines_map_()
|
||||
defines_map_(),
|
||||
cache_file_prefix_()
|
||||
{
|
||||
cache_file_prefix_
|
||||
= "cache-v" +
|
||||
boost::algorithm::replace_all_copy(game_config::revision,
|
||||
":", "_") +
|
||||
"-";
|
||||
|
||||
// To set-up initial defines map correctly
|
||||
clear_defines();
|
||||
}
|
||||
@ -177,9 +184,8 @@ namespace game_config {
|
||||
const std::string& cache = get_cache_dir();
|
||||
if(cache != "") {
|
||||
sha1_hash sha(defines_string.str()); // use a hash for a shorter display of the defines
|
||||
const std::string fname = cache + "/cache-v" +
|
||||
boost::algorithm::replace_all_copy(game_config::revision, ":", "_") +
|
||||
"-" + sha.display();
|
||||
const std::string fname = cache + "/" +
|
||||
cache_file_prefix_ + sha.display();
|
||||
const std::string fname_checksum = fname + ".checksum" + extension;
|
||||
|
||||
file_tree_checksum dir_checksum;
|
||||
|
@ -83,6 +83,8 @@ namespace game_config {
|
||||
bool force_valid_cache_, use_cache_, fake_invalid_cache_;
|
||||
preproc_map defines_map_;
|
||||
|
||||
std::string cache_file_prefix_;
|
||||
|
||||
void read_file(const std::string& file, config& cfg);
|
||||
void write_file(std::string file, const config& cfg);
|
||||
void write_file(std::string file, const preproc_map&);
|
||||
|
Loading…
x
Reference in New Issue
Block a user