Do not stop on first error while scanning files
This commit is contained in:
@@ -578,21 +578,31 @@ MediaScanner::scanMediaDirectory(boost::filesystem::path mediaDirectory, bool fo
|
|||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
|
|
||||||
boost::filesystem::recursive_directory_iterator itPath(mediaDirectory, ec);
|
boost::filesystem::recursive_directory_iterator itPath(mediaDirectory, ec);
|
||||||
|
if (ec)
|
||||||
|
{
|
||||||
|
LMS_LOG(DBUPDATER, ERROR) << "Cannot iterate over '" << mediaDirectory.string() << "': " << ec.message();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boost::filesystem::recursive_directory_iterator itEnd;
|
boost::filesystem::recursive_directory_iterator itEnd;
|
||||||
while (!ec && itPath != itEnd)
|
while (itPath != itEnd)
|
||||||
{
|
{
|
||||||
boost::filesystem::path path = *itPath;
|
boost::filesystem::path path = *itPath;
|
||||||
itPath.increment(ec);
|
|
||||||
|
|
||||||
if (!_running)
|
if (!_running)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (boost::filesystem::is_regular(path))
|
if (ec)
|
||||||
|
{
|
||||||
|
LMS_LOG(DBUPDATER, ERROR) << "Cannot process entry: " << ec.message();
|
||||||
|
}
|
||||||
|
else if (boost::filesystem::is_regular(path))
|
||||||
{
|
{
|
||||||
if (isFileSupported(path, _fileExtensions))
|
if (isFileSupported(path, _fileExtensions))
|
||||||
scanAudioFile(path, forceScan, stats );
|
scanAudioFile(path, forceScan, stats );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itPath.increment(ec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user