diff --git a/app/src/main/java/io/legado/app/help/BookHelp.kt b/app/src/main/java/io/legado/app/help/BookHelp.kt index 2f916adbe..0cdb7e1e8 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -108,20 +108,26 @@ object BookHelp { } fun hasContent(book: Book, bookChapter: BookChapter): Boolean { - if (downloadUri.isDocumentUri(App.INSTANCE)) { - DocumentFile.fromTreeUri(App.INSTANCE, downloadUri)?.let { root -> - return DocumentUtils.exists( - root, + when { + book.isLocalBook() -> { + return true + } + downloadUri.isDocumentUri(App.INSTANCE) -> { + DocumentFile.fromTreeUri(App.INSTANCE, downloadUri)?.let { root -> + return DocumentUtils.exists( + root, + "${bookChapterName(bookChapter)}.nb", + subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) + ) + } + } + else -> { + return FileUtils.exists( + File(downloadPath), "${bookChapterName(bookChapter)}.nb", subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) ) } - } else { - return FileUtils.exists( - File(downloadPath), - "${bookChapterName(bookChapter)}.nb", - subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) - ) } return false }