[K/N] Fixed problem with non-empty output directory

This commit is contained in:
Igor Chevdar
2022-09-09 12:59:58 +03:00
committed by Space
parent da367a467d
commit 1e6f7f6d58
@@ -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()
}