22 bool changesOccurred =
false;
26 changesOccurred =
true;
31 return changesOccurred;
36 std::filesystem::path filepath{
_path };
37 if (filepath.is_relative())
61 if (j.contains(
"path"))
63 j.at(
"path").get_to(
_path);
65 if (j.contains(
"fileType"))
79 LOG_ERROR(
"FileWriter needs the _fileType set in the child class.");
85 if (!std::filesystem::exists(filepath.parent_path()) && !std::filesystem::create_directories(filepath.parent_path()))
87 LOG_ERROR(
"Could not create directory '{}' for file '{}'", filepath.parent_path(), filepath);
93 _filestream.open(filepath, std::ios_base::trunc | std::ios_base::binary);
98 LOG_ERROR(
"Could not open file {}", filepath);
Config management for the Project.
nlohmann::json json
json namespace
Text Help Marker (?) with Tooltip.
Utility class for logging to console and file.
#define LOG_ERROR
Error occurred, which stops part of the program to work, but not everything.
#define LOG_TRACE
Detailled info to trace the execution of the program. Should not be called on functions which receive...
std::string _path
Path to the file.
FileType _fileType
File Type.
static const char * to_string(FileType type)
Converts the provided type into string.
void deinitialize()
Deinitialize the file reader.
bool guiConfig(const char *vFilters, const std::vector< std::string > &extensions, size_t id, const std::string &nameId)
ImGui config.
std::filesystem::path getFilepath()
Returns the path of the file.
void restore(const json &j)
Restores the node from a json object.
json save() const
Saves the node into a json object.
bool initialize()
Initialize the file reader.
std::ofstream _filestream
File stream to write the file.
std::filesystem::path GetOutputPath()
Get the path where logs and outputs are stored.