X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fio%2Ffilesystem.hpp;fp=src%2Fio%2Ffilesystem.hpp;h=3829e0deab46a2f0c316f7f2496f744b328c4bea;hb=ede25c0a2f59e21521d1cd962e6ea9d78169ca12;hp=0000000000000000000000000000000000000000;hpb=d02daa5a4805dc3184884f3a7cd7620e5787adcb;p=blank.git diff --git a/src/io/filesystem.hpp b/src/io/filesystem.hpp new file mode 100644 index 0000000..3829e0d --- /dev/null +++ b/src/io/filesystem.hpp @@ -0,0 +1,33 @@ +#ifndef BLANK_IO_FILESYSTEM_HPP_ +#define BLANK_IO_FILESYSTEM_HPP_ + +#include + + +namespace blank { + +/// check if give path points to an existing directory +bool is_dir(const char *); +inline bool is_dir(const std::string &s) { + return is_dir(s.c_str()); +} +/// check if give path points to an existing file +bool is_file(const char *); +inline bool is_file(const std::string &s) { + return is_file(s.c_str()); +} + +/// create given directory +/// @return true if the directory was created +/// the directory might already exist, see errno +bool make_dir(const char *); +inline bool make_dir(const std::string &s) { + return make_dir(s.c_str()); +} +/// create given directory and all parents +/// @return true if the directory was created or already exists +bool make_dirs(const std::string &); + +} + +#endif