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. |
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