mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-12 12:46:17 -05:00
Fix date / content changed check triggering on plugin start
This commit is contained in:
parent
7e940e515b
commit
d6bf9ed101
|
|
@ -124,8 +124,10 @@ bool MacroConditionFile::CheckChangeContent()
|
|||
|
||||
SetTempVarValue("content", filedata.toStdString());
|
||||
size_t newHash = strHash(filedata.toUtf8().constData());
|
||||
const bool contentChanged = newHash != _lastHash;
|
||||
const bool contentChanged = !_firstContentCheck &&
|
||||
(newHash != _lastHash);
|
||||
_lastHash = newHash;
|
||||
_firstContentCheck = false;
|
||||
return contentChanged;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +140,7 @@ bool MacroConditionFile::CheckChangeDate()
|
|||
QFile file(QString::fromStdString(_file));
|
||||
QDateTime newLastMod = QFileInfo(file).lastModified();
|
||||
SetVariableValue(newLastMod.toString().toStdString());
|
||||
const bool dateChanged = _lastMod != newLastMod;
|
||||
const bool dateChanged = _lastMod.isValid() && (_lastMod != newLastMod);
|
||||
_lastMod = newLastMod;
|
||||
SetTempVarValue("date", newLastMod.toString(Qt::ISODate).toStdString());
|
||||
return dateChanged;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ private:
|
|||
Condition _condition = Condition::MATCH;
|
||||
QDateTime _lastMod;
|
||||
size_t _lastHash = 0;
|
||||
bool _firstContentCheck = true;
|
||||
std::string _lastFile;
|
||||
std::string _basename;
|
||||
std::string _basenameComplete;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user