VERY experimental Nintendo Switch 2 emulator
C++
log/backend: Use in-class initializer for FileBackend
Lioncash4105a18d2170
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cppindex f0bb392c64..96efa977d8 100644--- a/src/common/logging/backend.cpp+++ b/src/common/logging/backend.cpp@@ -148,12 +148,14 @@ void ColorConsoleBackend::Write(const Entry& entry) {PrintColoredMessage(entry);}-FileBackend::FileBackend(const std::string& filename) : bytes_written(0) {- if (FS::Exists(filename + ".old.txt")) {- FS::Delete(filename + ".old.txt");+FileBackend::FileBackend(const std::string& filename) {+ const auto old_filename = filename + ".old.txt";++ if (FS::Exists(old_filename)) {+ FS::Delete(old_filename);}if (FS::Exists(filename)) {- FS::Rename(filename, filename + ".old.txt");+ FS::Rename(filename, old_filename);}// _SH_DENYWR allows read only access to the file for other programs.diff --git a/src/common/logging/backend.h b/src/common/logging/backend.hindex 84a544ea44..9dd2589c3c 100644--- a/src/common/logging/backend.h+++ b/src/common/logging/backend.h@@ -94,8 +94,8 @@ public:void Write(const Entry& entry) override;private:- Common::FS::IOFile file;- std::size_t bytes_written;+ FS::IOFile file;+ std::size_t bytes_written = 0;};/**