Added backing up previous logfile

This commit is contained in:
2021-12-10 03:24:43 +03:00
parent b8d3db9289
commit 5137eed759
2 changed files with 12 additions and 6 deletions

View File

@@ -37,6 +37,11 @@ void OpenLogFile() {
fs::path log_path = lpszPath;
log_path.replace_extension(L".log");
std::wstring logname = log_path.stem() += L".log";
std::wstring backupname = log_path.stem() += L".bak";
if (fs::exists(logname)) {
fs::rename(logname, backupname);
}
logfile.open(logname);
if (logfile.is_open()) {