diff --git a/src/app/main.cpp b/src/app/main.cpp index fef45828..a4f66f44 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -41,12 +41,12 @@ int main(int argc, char *argv[]) Version version = Version::fromString(GIT_VERSION_NUMBER); QApplication::setApplicationVersion(version.toDisplayString().c_str()); + QtApplication qtApp(argc, argv); if(AppPath::getAppPath().empty()) { AppPath::setAppPath(QCoreApplication::applicationDirPath().toStdString()); } setup(argc, argv); - QtApplication qtApp(argc, argv); qtApp.setAttribute(Qt::AA_UseHighDpiPixmaps); diff --git a/src/lib/utility/file/FileSystem.cpp b/src/lib/utility/file/FileSystem.cpp index 77592881..a97c77b2 100644 --- a/src/lib/utility/file/FileSystem.cpp +++ b/src/lib/utility/file/FileSystem.cpp @@ -115,6 +115,11 @@ bool FileSystem::exists(const std::string& path) return boost::filesystem::exists(boost::filesystem::path(path)); } +bool FileSystem::remove(const std::string& path) +{ + return boost::filesystem::remove(path); +} + std::string FileSystem::fileName(const std::string& path) { return boost::filesystem::path(path).filename().generic_string(); diff --git a/src/lib/utility/file/FileSystem.h b/src/lib/utility/file/FileSystem.h index c6656ab4..273f498e 100644 --- a/src/lib/utility/file/FileSystem.h +++ b/src/lib/utility/file/FileSystem.h @@ -29,6 +29,7 @@ public: static bool exists(const std::string& path); static std::string fileName(const std::string& path); static std::string absoluteFilePath(const std::string& path); + static bool remove(const std::string& path); static bool copy_directory(const FilePath& from, const FilePath& to); diff --git a/src/lib/utility/logging/FileLogger.cpp b/src/lib/utility/logging/FileLogger.cpp index aa1b6a3b..b5b655dd 100644 --- a/src/lib/utility/logging/FileLogger.cpp +++ b/src/lib/utility/logging/FileLogger.cpp @@ -82,10 +82,7 @@ void FileLogger::changeLogFile() m_suffix = ++m_suffix % s_amountOfLogFiles; m_currentLogFile = m_fileName + (m_suffix ? "1" : "0") + ".txt"; - if (FileSystem::exists(m_currentLogFile)) - { - std::remove(m_currentLogFile.c_str()); - } + FileSystem::remove(s_filePath + m_currentLogFile); } void FileLogger::logMessage(const std::string& type, const LogMessage& message)