utility: ringlogging fix, delete when switching log files
This commit is contained in:
+1
-1
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user