MassManager: fix a condition.
This commit is contained in:
parent
4ae9f83ab3
commit
ccf630c385
1 changed files with 7 additions and 2 deletions
|
@ -185,22 +185,27 @@ void MassManager::refreshStagedMasses() {
|
||||||
auto file_list = Utility::Path::list(_stagingAreaDirectory, ListFlag::SkipSpecial|ListFlag::SkipDirectories|ListFlag::SkipDotAndDotDot);
|
auto file_list = Utility::Path::list(_stagingAreaDirectory, ListFlag::SkipSpecial|ListFlag::SkipDirectories|ListFlag::SkipDotAndDotDot);
|
||||||
|
|
||||||
if(!file_list) {
|
if(!file_list) {
|
||||||
_lastError = _stagingAreaDirectory + " couldn't be opened"_s;
|
Utility::Error{} << _stagingAreaDirectory << "couldn't be opened";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto iter = std::remove_if(file_list->begin(), file_list->end(), [](Containers::StringView file){
|
auto iter = std::remove_if(file_list->begin(), file_list->end(), [](Containers::StringView file){
|
||||||
return file.hasSuffix(".sav"_s);
|
return !file.hasSuffix(".sav"_s);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto list_view = file_list->except(file_list->end() - iter);
|
auto list_view = file_list->except(file_list->end() - iter);
|
||||||
|
|
||||||
|
Utility::Debug{} << "Scanning for staged M.A.S.S.es...";
|
||||||
for(Containers::StringView file : list_view) {
|
for(Containers::StringView file : list_view) {
|
||||||
auto name = Mass::getNameFromFile(Utility::Path::join(_stagingAreaDirectory, file));
|
auto name = Mass::getNameFromFile(Utility::Path::join(_stagingAreaDirectory, file));
|
||||||
|
|
||||||
if(name) {
|
if(name) {
|
||||||
|
Utility::Debug{} << "Found staged M.A.S.S.:" << *name;
|
||||||
_stagedMasses[file] = *name;
|
_stagedMasses[file] = *name;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Utility::Warning{} << "Skipped:" << file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue