filesaver: count logic was wrong if --continue wasn't given
This commit is contained in:
부모
bc9fa97aa0
커밋
ccb6818e72
@ -63,7 +63,7 @@ int FileSaver::processFiles(const QVector<QString> paths, std::function<SaveFile
|
|||||||
bool keepGoing, bool verbose)
|
bool keepGoing, bool verbose)
|
||||||
{
|
{
|
||||||
std::atomic<bool> terminate{false};
|
std::atomic<bool> terminate{false};
|
||||||
std::atomic<int> errorsCount{0};
|
std::atomic<int> processedCount{0};
|
||||||
QtConcurrent::blockingMap(paths,
|
QtConcurrent::blockingMap(paths,
|
||||||
[&](const QString &path)
|
[&](const QString &path)
|
||||||
{
|
{
|
||||||
@ -78,27 +78,30 @@ int FileSaver::processFiles(const QVector<QString> paths, std::function<SaveFile
|
|||||||
SaveFileResult result = saverFunc(path);
|
SaveFileResult result = saverFunc(path);
|
||||||
if(result == DBFAIL || result == PROCESSFAIL)
|
if(result == DBFAIL || result == PROCESSFAIL)
|
||||||
{
|
{
|
||||||
errorsCount++;
|
|
||||||
Logger::error() << "Failed to process " << path << endl;
|
Logger::error() << "Failed to process " << path << endl;
|
||||||
if(!keepGoing)
|
if(!keepGoing)
|
||||||
{
|
{
|
||||||
terminate = true;
|
terminate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++processedCount;
|
||||||
if(verbose)
|
if(verbose)
|
||||||
{
|
{
|
||||||
if(result == SKIPPED)
|
if(result == SKIPPED)
|
||||||
{
|
{
|
||||||
Logger::info()
|
Logger::info() << "Skipped" << path
|
||||||
<< "Skipped" << path << "as it already exists in the database" << endl;
|
<< "as it already exists in the database" << endl;
|
||||||
}
|
}
|
||||||
else if(result == OK)
|
else if(result == OK)
|
||||||
{
|
{
|
||||||
Logger::info() << "Added" << path << endl;
|
Logger::info() << "Added" << path << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return paths.size() - errorsCount.load();
|
return processedCount.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo)
|
SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo)
|
||||||
|
불러오는 중...
Reference in New Issue
Block a user