SaveTool: make the file watcher less aggressive.
This commit is contained in:
parent
b377e0de6c
commit
1612e4372b
1 changed files with 7 additions and 4 deletions
|
@ -206,6 +206,8 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_moved_after_save = false;
|
||||||
|
|
||||||
switch(action) {
|
switch(action) {
|
||||||
case efsw::Actions::Add:
|
case efsw::Actions::Add:
|
||||||
if(Utility::String::endsWith(filename, _currentProfile->steamId() + ".sav")) {
|
if(Utility::String::endsWith(filename, _currentProfile->steamId() + ".sav")) {
|
||||||
|
@ -229,9 +231,6 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
|
||||||
if(!_currentMass || _currentMass != &(_massManager->hangar(index))) {
|
if(!_currentMass || _currentMass != &(_massManager->hangar(index))) {
|
||||||
_massManager->refreshHangar(index);
|
_massManager->refreshHangar(index);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
_currentMass->setDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -248,7 +247,10 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
|
||||||
_massManager->refreshHangar(index);
|
_massManager->refreshHangar(index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_currentMass->setDirty();
|
if(!is_moved_after_save) {
|
||||||
|
is_moved_after_save = false;
|
||||||
|
_currentMass->setDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,6 +258,7 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
|
||||||
case efsw::Actions::Moved:
|
case efsw::Actions::Moved:
|
||||||
if(Utility::String::endsWith(filename, _currentProfile->steamId() + ".sav")) {
|
if(Utility::String::endsWith(filename, _currentProfile->steamId() + ".sav")) {
|
||||||
if(Utility::String::endsWith(old_filename, ".tmp")) {
|
if(Utility::String::endsWith(old_filename, ".tmp")) {
|
||||||
|
is_moved_after_save = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue