refactor: unify book cache clearing for epub, txt, and xtc files (#1875)
This commit is contained in:
@@ -155,6 +155,21 @@ bool Txt::generateCoverBmp() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Txt::clearCache() const {
|
||||
if (!Storage.exists(cachePath.c_str())) {
|
||||
LOG_DBG("TXT", "Cache does not exist, no action needed");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Storage.removeDir(cachePath.c_str())) {
|
||||
LOG_ERR("TXT", "Failed to clear cache");
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_DBG("TXT", "Cache cleared successfully");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Txt::readContent(uint8_t* buffer, size_t offset, size_t length) const {
|
||||
if (!loaded) {
|
||||
return false;
|
||||
|
||||
@@ -22,6 +22,7 @@ class Txt {
|
||||
[[nodiscard]] size_t getFileSize() const { return fileSize; }
|
||||
|
||||
void setupCacheDir() const;
|
||||
bool clearCache() const;
|
||||
|
||||
// Cover image support - looks for cover.bmp/jpg/jpeg/png in same folder as txt file
|
||||
[[nodiscard]] std::string getCoverBmpPath() const;
|
||||
|
||||
Reference in New Issue
Block a user