Commit 12a5d295 authored by Matthieu Gallien's avatar Matthieu Gallien

fix local file indexer not to remove unmodified files after first scan

parent d33daa18
......@@ -228,6 +228,15 @@ void AbstractFileListing::scanDirectory(DataTypes::ListTrackDataType &newFiles,
continue;
}
auto itExistingFile = allFiles().find(newFilePath);
if (itExistingFile != allFiles().end()) {
if (*itExistingFile >= oneEntry.metadataChangeTime()) {
allFiles().erase(itExistingFile);
qCDebug(orgKdeElisaIndexer()) << "AbstractFileListing::scanDirectory" << newFilePath << "file not modified since last scan";
continue;
}
}
auto newTrack = scanOneFile(newFilePath, oneEntry);
if (newTrack.isValid() && d->mStopRequest == 0) {
......@@ -307,6 +316,7 @@ DataTypes::TrackDataType AbstractFileListing::scanOneFile(const QUrl &scanFile,
auto localFileName = scanFile.toLocalFile();
if (!d->mFileScanner.shouldScanFile(localFileName)) {
qCDebug(orgKdeElisaIndexer) << "AbstractFileListing::scanOneFile" << "invalid mime type";
return newTrack;
}
......@@ -315,6 +325,7 @@ DataTypes::TrackDataType AbstractFileListing::scanOneFile(const QUrl &scanFile,
if (itExistingFile != d->mAllFiles.end()) {
if (*itExistingFile >= scanFileInfo.metadataChangeTime()) {
d->mAllFiles.erase(itExistingFile);
qCDebug(orgKdeElisaIndexer) << "AbstractFileListing::scanOneFile" << "not changed file";
return newTrack;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment