pull/83/head
kunfei 5 years ago
parent cf8f5e1811
commit 1fff1bcb46
  1. 5
      app/src/main/java/io/legado/app/help/BookHelp.kt

@ -33,7 +33,7 @@ object BookHelp {
} }
private fun bookChapterName(bookChapter: BookChapter): String { private fun bookChapterName(bookChapter: BookChapter): String {
return String.format("%05d-%s", bookChapter.index, MD5Utils.md5Encode(bookChapter.title)) return String.format("%05d-%s", bookChapter.index, MD5Utils.md5Encode16(bookChapter.title))
} }
fun clearCache() { fun clearCache() {
@ -135,12 +135,11 @@ object BookHelp {
?.uri?.readText(App.INSTANCE) ?.uri?.readText(App.INSTANCE)
} }
} else { } else {
val path = FileUtils.getPath( val file = FileUtils.getFile(
File(downloadPath), File(downloadPath),
"${bookChapterName(bookChapter)}.nb", "${bookChapterName(bookChapter)}.nb",
subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) subDirs = *arrayOf(cacheFolderName, bookFolderName(book))
) )
val file = File(path)
if (file.exists()) { if (file.exists()) {
return file.readText() return file.readText()
} }

Loading…
Cancel
Save