#include "BookCacheUtils.h" #include #include #include #include #include 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()); }