1 #ifndef BLOBS_IO_FILESYSTEM_HPP_
2 #define BLOBS_IO_FILESYSTEM_HPP_
11 /// check if give path points to an existing directory
12 bool is_dir(const char *);
13 inline bool is_dir(const std::string &s) {
14 return is_dir(s.c_str());
16 /// check if give path points to an existing file
17 bool is_file(const char *);
18 inline bool is_file(const std::string &s) {
19 return is_file(s.c_str());
21 /// get timestamp of last modification
22 std::time_t file_mtime(const char *);
23 inline std::time_t file_mtime(const std::string &s) {
24 return file_mtime(s.c_str());
27 /// create given directory
28 /// @return true if the directory was created
29 /// the directory might already exist, see errno
30 bool make_dir(const char *);
31 inline bool make_dir(const std::string &s) {
32 return make_dir(s.c_str());
34 /// create given directory and all parents
35 /// @return true if the directory was created or already exists
36 bool make_dirs(const std::string &);
39 /// @return true on success
40 bool remove_file(const std::string &);
41 /// recursively remove given directory
42 /// may leave the directory partially removed on failure
43 /// @return true if the directory was completely removed
44 bool remove_dir(const std::string &);