fallback to copy if resources rename fails

This commit is contained in:
Chloe committed 2026-04-06 04:16:07 -07:00
1 parent 3cb0998274
commit 0a4f13789f
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>