From 76a9eee7d91792d0b4734ca8fa8017ee9c6ced4d Mon Sep 17 00:00:00 2001 From: hinerm Date: Mon, 6 May 2024 15:51:01 -0500 Subject: [PATCH] Run mkdir before copying new files over Necessary in case there are files in a new subdirectory structure. --- src/commonMain/kotlin/main.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commonMain/kotlin/main.kt b/src/commonMain/kotlin/main.kt index 9072a85..522885a 100644 --- a/src/commonMain/kotlin/main.kt +++ b/src/commonMain/kotlin/main.kt @@ -580,9 +580,12 @@ private fun applyUpdate(appDir: File, updateSubDir: File) { // Recursively copy over all files in the update subdir for (file in updateSubDir.ls()) { - if (file.isDirectory) applyUpdate(appDir, file) + val dest = appDir / file.path.substring((appDir / "update").path.length) + if (file.isDirectory) { + dest.mkdir() || error("Couldn't create path $dest") + applyUpdate(appDir, file) + } else { - val dest = appDir / file.path.substring((appDir / "update").path.length) if (file.length == 0L) { dest.rm() || error("Couldn't remove $dest") file.rm() || error("Couldn't remove $file")