diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-10-29 22:07:17 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-10-29 22:07:20 +0100 |
commit | a5e2adedf38f84a8be5e8d844e02991d3bbfecca (patch) | |
tree | 0663747e2b28defc2249a56ecbe194a7c8fa089b /include/dchat/FileUtil.hpp | |
parent | b1296f2c97c6fdc1c6a9922dc09c951b5cafdc12 (diff) |
Move files, expose include dir
Diffstat (limited to 'include/dchat/FileUtil.hpp')
-rw-r--r-- | include/dchat/FileUtil.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/dchat/FileUtil.hpp b/include/dchat/FileUtil.hpp new file mode 100644 index 0000000..097b607 --- /dev/null +++ b/include/dchat/FileUtil.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "StringView.hpp" +#include <boost/filesystem/path.hpp> +#include <stdexcept> + +namespace dchat +{ + class FileException : public std::runtime_error + { + public: + FileException(const std::string &errMsg) : std::runtime_error(errMsg) {} + }; + + // Throws FileException on error. + // Returned value is allocated with malloc and should be free'd by caller. + StringView getFileContent(const boost::filesystem::path &filepath); + + // Throws FileException on error + void fileReplace(const boost::filesystem::path &filepath, const StringView data); +} |