mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +00:00
fallback to copy if resources rename fails
This commit is contained in:
2 files changed
+9
-1
No files matched your search
@@ -206,7 +206,8 @@ class ReleaseManager private constructor(
|
||||
}
|
||||
|
||||
if (!outputDir.renameTo(finalDir)) {
|
||||
throw IOException("failed to rename resources output directory")
|
||||
println("Failed to rename temporary directory!")
|
||||
DownloadUtils.copyDirectory(outputDir, finalDir)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -160,6 +160,13 @@ object DownloadUtils {
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun copyDirectory(sourceFile: File, outputFile: File) = withContext(Dispatchers.IO) {
|
||||
sourceFile.copyRecursively(
|
||||
outputFile,
|
||||
overwrite = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// based on <https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/Progress.java>
|
||||
|
||||
Reference in new issue
Block a user