mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Remove cre cache file when deleting a book (#4022)
Store the cache file path in book settings, so we can delete it too when deleting the book.
This commit is contained in:
@@ -180,15 +180,17 @@ end
|
||||
-- we cannot do it in onSaveSettings() because getLastPercent() uses self.ui.document
|
||||
function ReaderRolling:onCloseDocument()
|
||||
self.ui.doc_settings:saveSetting("percent_finished", self:getLastPercent())
|
||||
-- also checks if DOM is coherent with styles; if not, invalidate the
|
||||
-- cache, so a new DOM is built on next opening
|
||||
if self.ui.document:isBuiltDomStale() then
|
||||
if self.ui.document:hasCacheFile() then
|
||||
local cache_file_path = self.ui.document:getCacheFilePath() -- nil if no cache file
|
||||
self.ui.doc_settings:saveSetting("cache_file_path", cache_file_path)
|
||||
if self.ui.document:hasCacheFile() then
|
||||
-- also checks if DOM is coherent with styles; if not, invalidate the
|
||||
-- cache, so a new DOM is built on next opening
|
||||
if self.ui.document:isBuiltDomStale() then
|
||||
logger.dbg("cre DOM may not be in sync with styles, invalidating cache file for a full reload at next opening")
|
||||
self.ui.document:invalidateCacheFile()
|
||||
end
|
||||
end
|
||||
logger.dbg("cre cache used:", self.ui.document:getCacheFilePath() or "none")
|
||||
logger.dbg("cre cache used:", cache_file_path or "none")
|
||||
end
|
||||
|
||||
function ReaderRolling:onCheckDomStyleCoherence()
|
||||
|
||||
Reference in New Issue
Block a user