diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-02-12 15:42:16 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-02-12 16:23:09 +0100 |
commit | 2f9ae9e9462a5a366461f20b4d0c2f4b80ef1b68 (patch) | |
tree | 165a71177182aec90f8d8fe888ffdbb7d801abcf /src/Storage.cpp | |
parent | a8d597d59e347a80b109060ec8c7a88827487f57 (diff) |
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.
Diffstat (limited to 'src/Storage.cpp')
-rw-r--r-- | src/Storage.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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; } } |