#9614 Check last write time for ESMRY files and SMSPEC files

This commit is contained in:
Magne Sjaastad
2023-01-03 14:52:33 +01:00
parent 4c0e7b2979
commit 28b3f16db1
6 changed files with 101 additions and 36 deletions

View File

@@ -25,6 +25,7 @@
#include <QDir>
#include <filesystem>
#include <memory>
#include <set>
@@ -362,3 +363,16 @@ std::map<QString, QStringList> RiaFilePathTools::keyPathComponentsForEachFilePat
return keyComponents;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaFilePathTools::isFirstOlderThanSecond( const std::string& firstFileName, const std::string& secondFileName )
{
if ( !std::filesystem::exists( firstFileName ) || !std::filesystem::exists( secondFileName ) ) return false;
auto timeFirstFile = std::filesystem::last_write_time( firstFileName );
auto timeSecondFile = std::filesystem::last_write_time( secondFileName );
return ( timeFirstFile < timeSecondFile );
}

View File

@@ -48,4 +48,6 @@ public:
static QStringList splitPathIntoComponents( const QString& path, bool splitExtensionIntoSeparateEntry = false );
static std::map<QString, QStringList> keyPathComponentsForEachFilePath( const QStringList& filePaths );
static bool isFirstOlderThanSecond( const std::string& firstFileName, const std::string& secondFileName );
};