26 #define LOG_FS LOG_STREAM(info, log_filesystem) 27 #define ERR_FS LOG_STREAM(err, log_filesystem) 35 std::remove_if(files.begin(), files.end(), [
this](
const std::string&
name) {
return match_file(
name); }),
38 std::remove_if(directories.begin(), directories.end(), [
this](
const std::string&
name) {
return match_dir(
name); }),
66 #ifdef HAS_RELATIVE_DEFPREF 96 #ifdef USE_INTERNAL_DATA 100 #if HAS_RELATIVE_LOCALEDIR 122 : nfiles(0), sum_size(0), modified(0)
126 nfiles (cfg[
"nfiles"].to_size_t()),
128 modified(cfg[
"modified"].to_time_t())
145 bool ends_with(
const std::string& str,
const std::string& suffix)
147 return str.size() >= suffix.size() && std::equal(suffix.begin(),suffix.end(),str.end()-suffix.size());
154 if(map_location.empty()) {
159 if(!map_location.empty()) {
173 std::vector<std::string> dirs;
176 for(std::vector<std::string>::const_iterator j = dirs.begin(); j != dirs.end(); ++j) {
186 if(checksum.
nfiles == 0) {
189 LOG_FS <<
"calculated data tree checksum: " 190 << checksum.
nfiles <<
" files; " 191 << checksum.
sum_size <<
" bytes" << std::endl;
static void get_file_tree_checksum_internal(const std::string &path, file_tree_checksum &res)
bool looks_like_pbl(const std::string &file)
bool ends_with(const std::string &str, const std::string &suffix)
bool wildcard_string_match(const std::string &str, const std::string &match)
Match using '*' as any number of characters (including none), '+' as one or more characters, and '?' as any one character.
std::string get_screenshot_dir()
std::string get_binary_file_location(const std::string &type, const std::string &filename)
Returns a complete path to the actual file of a given type or an empty string if the file isn't prese...
std::string get_saves_dir()
Definitions for the interface to Wesnoth Markup Language (WML).
void remove_blacklisted_files_and_dirs(std::vector< std::string > &files, std::vector< std::string > &directories) const
static bfs::path get_dir(const bfs::path &dirpath)
bool match_file(const std::string &name) const
std::string get_user_data_dir()
std::vector< std::string > directory_patterns_
std::string get_intl_dir()
void get_files_in_dir(const std::string &dir, std::vector< std::string > *files, std::vector< std::string > *dirs, name_mode mode, filter_mode filter, reorder_mode reorder, file_tree_checksum *checksum)
Populates 'files' with all the files and 'dirs' with all the directories in dir.
std::vector< std::string > file_patterns_
void write(config &cfg) const
bool operator==(const file_tree_checksum &rhs) const
std::string get_default_prefs_file()
std::string read_file(const std::string &fname)
Basic disk I/O - read file.
std::string read_map(const std::string &name)
Encapsulates the map of the game.
Some defines: VERSION, PACKAGE, MIN_SAVEGAME_VERSION.
std::string get_wml_location(const std::string &filename, const std::string ¤t_dir)
Returns a complete path to the actual WML file or directory or an empty string if the file isn't pres...
Declarations for File-IO.
std::string lowercase(const std::string &s)
Returns a lowercased version of the string.
const file_tree_checksum & data_tree_checksum(bool reset=false)
Get the time at which the data/ tree was last modified at.
std::string get_user_config_dir()
std::string get_addons_dir()
std::string get_credentials_file()
Standard logging facilities (interface).
static lg::log_domain log_filesystem("filesystem")
std::string get_prefs_file()
bool match_dir(const std::string &name) const
A config object defines a single node in a WML file, with access to child nodes.
std::string get_save_index_file()
std::string default_preferences_path