ifw-core  5.0.0-pre2
file.hpp
Go to the documentation of this file.
1 
6 #ifndef IFW_CORE_UTILS_FILE_HPP_
7 #define IFW_CORE_UTILS_FILE_HPP_
8 
9 #include <string>
10 
11 #include <core/utils/base/base.hpp>
12 
13 namespace core::utils::file {
14 
16  std::string CheckAddExtension(const std::string& filename,
17  const std::string& extension);
18 
20  void RemoveFile(const std::string& filename);
21 
27  std::string LoadFile(const std::string& filename,
28  std::string* complete_filename = nullptr);
29 
36  void SaveFile(const std::string& filename,
37  const std::string& buffer,
38  const bool overwrite = true);
39 
44  void CheckCreatePath(const std::string& path);
45 
46 }
47 
48 #endif // !IFW_CORE_UTILS_FILE_HPP_
Definition: file.cpp:16
void SaveFile(const std::string &filename, const std::string &buffer, const bool overwrite)
Save the contents inthe buffer into the given filename.
Definition: file.cpp:69
void RemoveFile(const std::string &filename)
Remove the referenced file, if it exists.
Definition: file.cpp:28
std::string LoadFile(const std::string &filename, std::string *complete_filename)
Load a file and return the content.
Definition: file.cpp:45
std::string CheckAddExtension(const std::string &filename, const std::string &extension)
Check if filename has the specified extension (no initiating dot). If not, add it.
Definition: file.cpp:18
void CheckCreatePath(const std::string &path)
Check if the given path exists. If not, create it.
Definition: file.cpp:97