// // Created by zhaohe on 19-5-31. // #pragma once #include #include #include #include #include #include #include #include #include #include #include #include "iflytopcpp/core/spdlogfactory/logger.hpp" namespace iflytop { namespace core { using namespace std; class FileUtils { ENABLE_LOGGER(FileUtils); public: // judegefile bool exist(const string &path); bool isDirectory(const string &path); // bool delFile(const string &filePath); // mkfile bool makeDirIfNoExist(const string &path); // readfile string readFileAsString(const string &filePath); std::vector readFileAsBuffer(const string &filePath); // write file bool writeToFile(const string &fileName, const string &buf); bool writeToFile(const string &fileName, const char *buf, size_t size); shared_ptr openTrunc(const string &fileName); // filename operat // bool getRepetitionFileName(string fileName, string suffix, string &outfilename, int maxNum = -1); // bool getRepetitionDirName(string fileName, string &outfilename, int maxNum = -1); }; } // namespace core } // namespace iflytop