From 2f9ae9e9462a5a366461f20b4d0c2f4b80ef1b68 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 12 Feb 2022 15:42:16 +0100 Subject: Local-manga: improve loading of page when using slow medium Especially when using NFS. Only get the latest chapter when needed and cache link to the cover page. --- src/Storage.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Storage.cpp') diff --git a/src/Storage.cpp b/src/Storage.cpp index f4732b8..effa70b 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -246,7 +246,9 @@ namespace QuickMedia { void for_files_in_dir(const Path &path, FileIteratorCallback callback) { try { for(auto &p : std::filesystem::directory_iterator(path.data)) { - if(!callback(p.path().string())) + std::error_code ec; + const FileType file_type = p.is_directory(ec) ? FileType::DIRECTORY : FileType::REGULAR; + if(!callback(p.path().string(), file_type)) break; } } catch(const std::filesystem::filesystem_error &err) { @@ -285,7 +287,9 @@ namespace QuickMedia { } for(auto &p : paths) { - if(!callback(p.path().string())) + std::error_code ec; + const FileType file_type = p.is_directory(ec) ? FileType::DIRECTORY : FileType::REGULAR; + if(!callback(p.path().string(), file_type)) break; } } @@ -312,7 +316,9 @@ namespace QuickMedia { } for(auto &p : paths) { - if(!callback(p.path().string())) + std::error_code ec; + const FileType file_type = p.is_directory(ec) ? FileType::DIRECTORY : FileType::REGULAR; + if(!callback(p.path().string(), file_type)) break; } } -- cgit v1.2.3