]> git.localhorst.tv Git - blank.git/blob - src/io/filesystem.hpp
b69352a4ba962a4292031ef1662fd5a2274561f4
[blank.git] / src / io / filesystem.hpp
1 #ifndef BLANK_IO_FILESYSTEM_HPP_
2 #define BLANK_IO_FILESYSTEM_HPP_
3
4 #include <ctime>
5 #include <string>
6
7
8 namespace blank {
9
10 /// check if give path points to an existing directory
11 bool is_dir(const char *);
12 inline bool is_dir(const std::string &s) {
13         return is_dir(s.c_str());
14 }
15 /// check if give path points to an existing file
16 bool is_file(const char *);
17 inline bool is_file(const std::string &s) {
18         return is_file(s.c_str());
19 }
20 /// get timestamp of last modification
21 std::time_t file_mtime(const char *);
22 inline std::time_t file_mtime(const std::string &s) {
23         return file_mtime(s.c_str());
24 }
25
26 /// create given directory
27 /// @return true if the directory was created
28 ///         the directory might already exist, see errno
29 bool make_dir(const char *);
30 inline bool make_dir(const std::string &s) {
31         return make_dir(s.c_str());
32 }
33 /// create given directory and all parents
34 /// @return true if the directory was created or already exists
35 bool make_dirs(const std::string &);
36
37 }
38
39 #endif