From da6b698b938792be54ef7e4ab82b889d78540573 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Fri, 20 Dec 2024 00:21:22 -0800 Subject: [PATCH] Copy single file patch result even on failure --- .../core/tasks/patching/ApplySingleFilePatches.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt index c35959967..bacd49785 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt @@ -124,11 +124,13 @@ abstract class ApplySingleFilePatches : BaseTask() { .rejectsPath(tmpRej) .build() - if (op.operate().exit != 0) { - return@use "Patch failed on ${patch.patchFile.path}, see log above. Rejects at $tmpRej" - } + val result = op.operate() workFile.copyTo(patch.outputFile.path.createParentDirectories(), true) + + if (result.exit != 0) { + return@use "Patch failed on ${patch.patchFile.path}, see log above. Rejects at $tmpRej" + } } else { upstream.path.resolve(patch.path.get()) .copyTo(patch.outputFile.path.createParentDirectories(), true)