File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 2626#include < filesystem>
2727#include < iostream>
2828#include < set>
29+ #include < queue>
2930
3031namespace fs = std::filesystem;
3132
@@ -264,7 +265,7 @@ void Manager::addBooksFromDirectory(const std::string& path,
264265 dirQueue.push (fs::absolute (path).u8string ());
265266 int totalBooksAdded = 0 ;
266267 if (verboseFlag)
267- std::cout << " Starting BFS traversal at root directory: " << dirQueue.front () << std::endl;
268+ std::cout << " Adding books from the directory tree : " << dirQueue.front () << std::endl;
268269
269270 while (!dirQueue.empty ()) {
270271 const auto currentPath = dirQueue.front ();
@@ -282,13 +283,15 @@ void Manager::addBooksFromDirectory(const std::string& path,
282283 dirQueue.push (pathString);
283284 else if (verboseFlag)
284285 std::cout << " Already iterated over " << pathString << " . Skipping..." << std::endl;
285- } else {
286+ } else if (resolvedPath. extension () == " .zim " || resolvedPath. extension () == " .zimaa " ) {
286287 if (!this ->addBookFromPath (pathString, pathString, " " , false )) {
287288 std::cerr << " Could not add " << pathString << " into the library." << std::endl;
288289 } else if (verboseFlag) {
289290 std::cout << " Added " << pathString << " into the library." << std::endl;
290291 totalBooksAdded++;
291292 }
293+ } else if (verboseFlag) {
294+ std::cout << " Skipped " << pathString << " - unsupported file type or permission denied." << std::endl;
292295 }
293296 }
294297 iteratedDirs.insert (currentPath);
You can’t perform that action at this time.
0 commit comments