Skip to content

Commit

Permalink
copy file original file attributes on temp file move
Browse files Browse the repository at this point in the history
  • Loading branch information
Snd-R committed Sep 20, 2023
1 parent 0f2711f commit 2086cf9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/org/snd/metadata/comicinfo/ComicInfoWriter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import org.snd.common.exceptions.ValidationException
import org.snd.metadata.comicinfo.model.ComicInfo
import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file.Path
import java.nio.file.StandardCopyOption.COPY_ATTRIBUTES
import java.nio.file.StandardCopyOption.REPLACE_EXISTING
import java.util.zip.Deflater.NO_COMPRESSION
import java.util.zip.ZipEntry
import kotlin.io.path.createTempFile
Expand Down Expand Up @@ -65,7 +67,7 @@ class ComicInfoWriter private constructor(
copyEntries(zip, output)
}
}
tempFile.moveTo(archivePath, overwrite = true)
tempFile.moveTo(archivePath, REPLACE_EXISTING, COPY_ATTRIBUTES)
}.onFailure {
tempFile.deleteIfExists()
throw it
Expand Down Expand Up @@ -95,7 +97,7 @@ class ComicInfoWriter private constructor(
putComicInfoEntry(comicInfoToWrite, output)
}
}
tempFile.moveTo(archivePath, overwrite = true)
tempFile.moveTo(archivePath, REPLACE_EXISTING, COPY_ATTRIBUTES)
}.onFailure {
tempFile.deleteIfExists()
throw it
Expand Down

0 comments on commit 2086cf9

Please sign in to comment.