Minor cleanup

This commit is contained in:
Veloman Yunkan 2024-08-25 18:10:08 +04:00 committed by Kelson
parent 43fde1640c
commit dee1365327

View File

@ -912,18 +912,16 @@ size_t ContentManager::handleNewZimFiles(const QString& dirPath, const QStringSe
return countOfSuccessfullyAddedZims; return countOfSuccessfullyAddedZims;
} }
int ContentManager::handleZimFileInMonitoredDir(QString dirPath, QString file) int ContentManager::handleZimFileInMonitoredDir(QString dir, QString fileName)
{ {
const auto kiwixLib = mp_library->getKiwixLibrary(); const auto bookPath = QDir::toNativeSeparators(dir + "/" + fileName);
kiwix::Manager manager(kiwixLib); kiwix::Manager manager(mp_library->getKiwixLibrary());
auto& zimsInDir = m_knownZimsInDir[dirPath];
const auto bookPath = QDir::toNativeSeparators(dirPath + "/" + file);
DBGOUT("directory monitoring: file appeared: " << bookPath); DBGOUT("directory monitoring: file appeared: " << bookPath);
if ( mp_library->isBeingDownloadedByUs(bookPath) ) { if ( mp_library->isBeingDownloadedByUs(bookPath) ) {
DBGOUT(" it is being downloaded by us, ignoring..."); DBGOUT(" it is being downloaded by us, ignoring...");
} else if ( manager.addBookFromPath(bookPath.toStdString()) ) { } else if ( manager.addBookFromPath(bookPath.toStdString()) ) {
DBGOUT(" and was added to the library"); DBGOUT(" and was added to the library");
zimsInDir.insert(file); m_knownZimsInDir[dir].insert(fileName);
return 1; return 1;
} else { } else {
DBGOUT(" but could not be added to the library"); DBGOUT(" but could not be added to the library");