X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fio%2Ffilesystem.hpp;h=2af55fcce265d866ef33139a470fb0555fc28cd3;hb=cdd865c1934eccbb1f1d0ffaf041e53f0fdd524b;hp=3829e0deab46a2f0c316f7f2496f744b328c4bea;hpb=ede25c0a2f59e21521d1cd962e6ea9d78169ca12;p=blank.git diff --git a/src/io/filesystem.hpp b/src/io/filesystem.hpp index 3829e0d..2af55fc 100644 --- a/src/io/filesystem.hpp +++ b/src/io/filesystem.hpp @@ -1,6 +1,7 @@ #ifndef BLANK_IO_FILESYSTEM_HPP_ #define BLANK_IO_FILESYSTEM_HPP_ +#include #include @@ -16,6 +17,11 @@ bool is_file(const char *); inline bool is_file(const std::string &s) { return is_file(s.c_str()); } +/// get timestamp of last modification +std::time_t file_mtime(const char *); +inline std::time_t file_mtime(const std::string &s) { + return file_mtime(s.c_str()); +} /// create given directory /// @return true if the directory was created @@ -28,6 +34,14 @@ inline bool make_dir(const std::string &s) { /// @return true if the directory was created or already exists bool make_dirs(const std::string &); +/// remove given file +/// @return true on success +bool remove_file(const std::string &); +/// recursively remove given directory +/// may leave the directory partially removed on failure +/// @return true if the directory was completely removed +bool remove_dir(const std::string &); + } #endif