|
|
@ -30,15 +30,16 @@ object LocalBook { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun deleteBook(book: Book, deleteOriginal: Boolean) { |
|
|
|
fun deleteBook(book: Book, deleteOriginal: Boolean) { |
|
|
|
if (book.isTxt()) { |
|
|
|
kotlin.runCatching { |
|
|
|
val bookFile = |
|
|
|
if (book.isTxt()) { |
|
|
|
FileUtils.getFile(AnalyzeTxtFile.cacheFolder, book.originName, subDirs = *arrayOf()) |
|
|
|
val bookFile = FileUtils.getFile(AnalyzeTxtFile.cacheFolder, book.originName) |
|
|
|
bookFile.delete() |
|
|
|
bookFile.delete() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (deleteOriginal) { |
|
|
|
if (deleteOriginal) { |
|
|
|
val uri = Uri.parse(book.bookUrl) |
|
|
|
val uri = Uri.parse(book.bookUrl) |
|
|
|
DocumentFile.fromSingleUri(App.INSTANCE, uri)?.delete() |
|
|
|
DocumentFile.fromSingleUri(App.INSTANCE, uri)?.delete() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |