Skip to content

Commit

Permalink
Run mkdir before copying new files over
Browse files Browse the repository at this point in the history
Necessary in case there are files in a new subdirectory structure.
  • Loading branch information
hinerm committed May 6, 2024
1 parent fc67fe0 commit 76a9eee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/commonMain/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 76a9eee

Please sign in to comment.