pull/1738/head
kunfei 3 years ago
parent 1562e956cd
commit 3086b51c92
  1. 2
      app/src/main/java/io/legado/app/ui/document/HandleFileViewModel.kt
  2. 4
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt

@ -47,7 +47,7 @@ class HandleFileViewModel(application: Application) : BaseViewModel(application)
newDoc!!.writeBytes(context, bytes)
newDoc.uri
} else {
val file = File(uri.path!!)
val file = File(uri.path ?: uri.toString())
val newFile = FileUtils.createFileIfNotExist(file, fileName)
newFile.writeBytes(bytes)
Uri.fromFile(newFile)

@ -142,8 +142,8 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application),
?.writeBytes(context, biteArray)
}
} else {
val file =
FileUtils.createFileIfNotExist(File(uri.path ?: uri.toString()), fileName)
val dir = File(uri.path ?: uri.toString())
val file = FileUtils.createFileIfNotExist(dir, fileName)
file.writeBytes(biteArray)
}
} ?: throw Throwable("NULL")

Loading…
Cancel
Save