优化
This commit is contained in:
@@ -47,7 +47,7 @@ class HandleFileViewModel(application: Application) : BaseViewModel(application)
|
|||||||
newDoc!!.writeBytes(context, bytes)
|
newDoc!!.writeBytes(context, bytes)
|
||||||
newDoc.uri
|
newDoc.uri
|
||||||
} else {
|
} else {
|
||||||
val file = File(uri.path!!)
|
val file = File(uri.path ?: uri.toString())
|
||||||
val newFile = FileUtils.createFileIfNotExist(file, fileName)
|
val newFile = FileUtils.createFileIfNotExist(file, fileName)
|
||||||
newFile.writeBytes(bytes)
|
newFile.writeBytes(bytes)
|
||||||
Uri.fromFile(newFile)
|
Uri.fromFile(newFile)
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application),
|
|||||||
?.writeBytes(context, biteArray)
|
?.writeBytes(context, biteArray)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val file =
|
val dir = File(uri.path ?: uri.toString())
|
||||||
FileUtils.createFileIfNotExist(File(uri.path ?: uri.toString()), fileName)
|
val file = FileUtils.createFileIfNotExist(dir, fileName)
|
||||||
file.writeBytes(biteArray)
|
file.writeBytes(biteArray)
|
||||||
}
|
}
|
||||||
} ?: throw Throwable("NULL")
|
} ?: throw Throwable("NULL")
|
||||||
|
|||||||
Reference in New Issue
Block a user