BRING BACK OLD LOGS

This commit is contained in:
lizzie 2026-03-07 03:19:23 +00:00 committed by crueter
parent a57331ddbc
commit 4e96e0a1ff

View file

@ -247,6 +247,12 @@ struct ColorConsoleBackend final : public Backend {
/// @brief Backend that writes to a file passed into the constructor
struct FileBackend final : public Backend {
explicit FileBackend(const std::filesystem::path& filename) noexcept {
auto old_filename = filename;
old_filename += ".old.txt";
// Existence checks are done within the functions themselves.
// We don't particularly care if these succeed or not.
void(FS::RemoveFile(old_filename));
void(FS::RenameFile(filename, old_filename));
file.emplace(filename, FS::FileAccessMode::Write, FS::FileType::TextFile);
}
~FileBackend() noexcept override = default;