修改导出文件名对windows路径友好

pull/382/head
10bits 4 years ago
parent c622ed579d
commit 1bde9f77ab
  1. 4
      app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt

@ -35,7 +35,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
} }
private fun export(doc: DocumentFile, book: Book) { private fun export(doc: DocumentFile, book: Book) {
val filename = "${book.name} 作者:${book.author}.txt" val filename = "${book.name} by ${book.author}.txt"
val content = getAllContents(book) val content = getAllContents(book)
DocumentUtils.createFileIfNotExist(doc, filename) DocumentUtils.createFileIfNotExist(doc, filename)
?.writeText(context, content) ?.writeText(context, content)
@ -73,7 +73,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
} }
private fun export(file: File, book: Book) { private fun export(file: File, book: Book) {
val filename = "${book.name} 作者:${book.author}.txt" val filename = "${book.name} by ${book.author}.txt"
FileUtils.createFileIfNotExist(file, filename) FileUtils.createFileIfNotExist(file, filename)
.writeText(getAllContents(book)) .writeText(getAllContents(book))
WebDavHelp.exportWebDav(file.absolutePath, filename)//导出到webdav WebDavHelp.exportWebDav(file.absolutePath, filename)//导出到webdav

Loading…
Cancel
Save