From 1e6f7f6d58d0f4396de5c057e301e55f90e4b09c Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Fri, 9 Sep 2022 12:59:58 +0300 Subject: [PATCH] [K/N] Fixed problem with non-empty output directory --- .../src/org/jetbrains/kotlin/backend/konan/Linker.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Linker.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Linker.kt index 2e1a65c45ed..32e69a03422 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Linker.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Linker.kt @@ -41,7 +41,8 @@ internal class CacheStorage(val context: Context) { val outputFiles = context.config.outputFiles // For caches the output file is a directory. It might be created by someone else, // we have to delete it in order for the next renaming operation to succeed. - outputFiles.mainFile.delete() + // TODO: what if the directory is not empty? + java.io.File(outputFiles.mainFileName).delete() if (!outputFiles.tempCacheDirectory!!.renameTo(outputFiles.mainFile)) outputFiles.tempCacheDirectory.deleteRecursively() }