Something went wrong. Try again.
A fork of https://github.com/crosspoint-reader/crosspoint-reader
Something went wrong. Try again.
978 B · 34 lines
C++
1234567891011121314151617181920212223242526272829303132333435#include "BookCacheUtils.h"
#include <Epub.h>#include <FsHelpers.h>#include <Logging.h>#include <Txt.h>#include <Xtc.h>
bool isBookCacheDirectoryName(const char* name) { if (!name) { return false; }
constexpr char EPUB_PREFIX[] = "epub_"; constexpr char TXT_PREFIX[] = "txt_"; constexpr char XTC_PREFIX[] = "xtc_";
return strncmp(name, EPUB_PREFIX, std::size(EPUB_PREFIX) - 1) == 0 || strncmp(name, TXT_PREFIX, std::size(TXT_PREFIX) - 1) == 0 || strncmp(name, XTC_PREFIX, std::size(XTC_PREFIX) - 1) == 0;}
void clearBookCache(const std::string& path) { if (FsHelpers::hasEpubExtension(path)) { Epub(path, "/.crosspoint").clearCache(); } else if (FsHelpers::hasXtcExtension(path)) { Xtc(path, "/.crosspoint").clearCache(); } else if (FsHelpers::hasTxtExtension(path)) { Txt(path, "/.crosspoint").clearCache(); } else { return; } LOG_DBG("BookCache", "Done checking metadata cache for: %s", path.c_str());}