16 #define LOG_FS LOG_STREAM(info, log_filesystem)
17 #define ERR_FS LOG_STREAM(err, log_filesystem)
46 #ifdef __native_client__
50 return "/wesnoth-userdata/preferences";
55 return "/wesnoth-userdata/save_index";
60 const std::string dir_path =
"/wesnoth-userdata/saves";
73 #ifdef HAS_RELATIVE_DEFPREF
101 return get_cwd() +
"/translations";
104 #ifdef USE_INTERNAL_DATA
108 #if HAS_RELATIVE_LOCALEDIR
130 : nfiles(0), sum_size(0), modified(0)
134 nfiles (cfg[
"nfiles"].to_size_t()),
135 sum_size(cfg[
"size"].to_size_t()),
136 modified(cfg[
"modified"].to_time_t())
155 return str.size() >= suffix.size() && std::equal(suffix.begin(),suffix.end(),str.end()-suffix.size());
162 if(!map_location.empty()) {
176 std::vector<std::string> dirs;
179 for(std::vector<std::string>::const_iterator j = dirs.begin(); j != dirs.end(); ++j) {
189 if(checksum.
nfiles == 0) {
192 LOG_FS <<
"calculated data tree checksum: "
193 << checksum.
nfiles <<
" files; "
194 << 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)
scoped_istream & operator=(std::istream *)
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), and '?' as any one character.
utf8::string lowercase(const utf8::string &s)
Returns a lowercased version of the string.
std::string get_screenshot_dir()
std::string get_saves_dir()
Definitions for the interface to Wesnoth Markup Language (WML).
GLsizei const char ** path
std::string get_user_data_dir()
std::string get_intl_dir()
scoped_ostream & operator=(std::ostream *)
Templates and utility-routines for strings and numbers.
std::string get_dir(const std::string &dir)
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.
void get_files_in_dir(const std::string &dir, std::vector< std::string > *files, std::vector< std::string > *dirs=nullptr, file_name_option mode=FILE_NAME_ONLY, file_filter_option filter=NO_FILTER, file_reorder_option reorder=DONT_REORDER, file_tree_checksum *checksum=nullptr)
Populates 'files' with all the files and 'dirs' with all the directories in dir.
std::string get_wml_location(const std::string &filename, const std::string ¤t_dir=std::string())
Returns a complete path to the actual WML file or directory or an empty string if the file isn't pres...
void write(config &cfg) const
Declarations for File-IO.
const file_tree_checksum & data_tree_checksum(bool reset=false)
Get the time at which the data/ tree was last modified at.
GLuint const GLchar * name
std::string get_user_config_dir()
std::string get_addons_dir()
Standard logging facilities (interface).
static lg::log_domain log_filesystem("filesystem")
std::string get_prefs_file()
A config object defines a single node in a WML file, with access to child nodes.
bool operator==(const file_tree_checksum &rhs) const
std::string get_save_index_file()
GLsizei const GLcharARB ** string
std::string default_preferences_path