|
|
@ -60,12 +60,14 @@ object BookHelp { |
|
|
|
DocumentUtils.getDirDocument( |
|
|
|
DocumentUtils.getDirDocument( |
|
|
|
root, |
|
|
|
root, |
|
|
|
subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) |
|
|
|
subDirs = *arrayOf(cacheFolderName, bookFolderName(book)) |
|
|
|
)?.listFiles()?.forEach { |
|
|
|
)?.uri?.let { uri -> |
|
|
|
if (it.name?.startsWith(String.format("%05d", bookChapter.index)) == true) { |
|
|
|
DocumentUtils.listFiles(App.INSTANCE, uri).forEach { |
|
|
|
it.delete() |
|
|
|
if (it.name.startsWith(String.format("%05d", bookChapter.index))) { |
|
|
|
|
|
|
|
DocumentFile.fromSingleUri(App.INSTANCE, it.uri)?.delete() |
|
|
|
return@forEach |
|
|
|
return@forEach |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
DocumentUtils.createFileIfNotExist( |
|
|
|
DocumentUtils.createFileIfNotExist( |
|
|
|
root, |
|
|
|
root, |
|
|
|
"${bookChapterName(bookChapter)}.nb", |
|
|
|
"${bookChapterName(bookChapter)}.nb", |
|
|
|