Kotlin conversion of UploadFileOperation#17108
Conversation
118a028 to
9efa156
Compare
|
APK file: https://github.com/nextcloud/android/actions/runs/27058366047/artifacts/7453194578 |
| Log_OC.d(TAG, "Creating temporal folder") | ||
| val temporalParent = targetFile.parentFile | ||
|
|
||
| if (!temporalParent!!.mkdirs() && !temporalParent.isDirectory) { |
| Log_OC.d(TAG, "Creating temporal folder") | ||
| val temporalParent = targetFile.parentFile | ||
|
|
||
| if (!temporalParent!!.mkdirs() && !temporalParent.isDirectory) { |
| } | ||
|
|
||
| Log_OC.d(TAG, "Creating temporal file") | ||
| if (!targetFile.createNewFile() && !targetFile.isFile) { |
| } | ||
|
|
||
| Log_OC.d(TAG, "Creating temporal file") | ||
| if (!targetFile.createNewFile() && !targetFile.isFile) { |
| } else { | ||
| `in` = FileInputStream(sourceFile) | ||
| } | ||
| out = FileOutputStream(targetFile) |
| private fun move(sourceFile: File, targetFile: File) { | ||
| if (targetFile != sourceFile) { | ||
| val expectedFolder = targetFile.parentFile | ||
| Files.createDirectories(expectedFolder!!.toPath()) |
| val expectedFolder = targetFile.parentFile | ||
| Files.createDirectories(expectedFolder!!.toPath()) | ||
|
|
||
| if (expectedFolder.isDirectory) { |
| Files.createDirectories(expectedFolder!!.toPath()) | ||
|
|
||
| if (expectedFolder.isDirectory) { | ||
| if (!sourceFile.renameTo(targetFile)) { |
| if (expectedFolder.isDirectory) { | ||
| if (!sourceFile.renameTo(targetFile)) { | ||
| // try to copy and then delete | ||
| Files.createFile(targetFile.toPath()) |
| Files.createFile(targetFile.toPath()) | ||
| try { | ||
| FileInputStream(sourceFile).channel.use { inChannel -> | ||
| FileOutputStream(targetFile).channel.use { outChannel -> |
b5e43ff to
317a04b
Compare
|
APK file: https://github.com/nextcloud/android/actions/runs/27059364136/artifacts/7453518059 |
Signed-off-by: Hannes Achleitner <hannes.software@gmx.at>
317a04b to
79ab1da
Compare
|
APK file: https://github.com/nextcloud/android/actions/runs/27059855267/artifacts/7453666242 |
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
I was investigation how to change Wifi upload mechanism, and I found that causing class is still Java 👎
So I converted it in advance to Kotlin without changing anything in the logic. I hope that tests will check, if there is something now faulty