Skip to content

Commit

Permalink
try to fix backup log file on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Dec 22, 2024
1 parent d056130 commit 78ad91e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,13 @@ class Application : public QApplication
// Startup logging.
dir.setPath(Settings.appDataLocation());
if (!dir.exists()) dir.mkpath(dir.path());
auto previousLogName = dir.filePath("shotcut-log.bak");
QFile::remove(previousLogName);
QFile::copy(dir.filePath("shotcut-log.txt"), previousLogName);
const QString logFileName = dir.filePath("shotcut-log.txt");
QFile::remove(logFileName);
const auto previousLogName = dir.filePath("shotcut-log.bak");
if (QFile::exists(previousLogName))
QFile::remove(previousLogName);
const auto logFileName = dir.filePath("shotcut-log.txt");
LOG_INFO() << "Renaming log file" << logFileName << "to" << previousLogName;
if (!QFile::rename(logFileName, previousLogName))
LOG_INFO() << "Failed to rename backup log file" << previousLogName;
FileAppender *fileAppender = new FileAppender(logFileName);
fileAppender->setFormat("[%{type:-7}] <%{function}> %{message}\n");
cuteLogger->registerAppender(fileAppender);
Expand Down

0 comments on commit 78ad91e

Please sign in to comment.