Skip to content

Commit

Permalink
Removing files from intermediate dir before copying
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromfmachado committed Dec 20, 2024
1 parent ad3eb0c commit 2fb6d83
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,14 @@ abstract class RoborazziPlugin : Plugin<Project> {
// outputDir.get().asFileTree.forEach {
// println("Copy file ${finalizeTask.absolutePath} to ${intermediateDir.get()}")
// }

// Delete all images from the intermediateDir
intermediateDir.get().asFile.walkTopDown().forEach { file ->
if (KnownImageFileExtensions.contains(file.extension)) {
file.delete()
}
}

outputDir.get().asFile.mkdirs()
outputDir.get().asFile.copyRecursively(
target = intermediateDir.get().asFile,
Expand Down Expand Up @@ -616,13 +624,6 @@ abstract class RoborazziPlugin : Plugin<Project> {
roborazziResults: CaptureResults,
) {
if (roborazziProperties["roborazzi.cleanupOldScreenshots"] == "true") {
// Delete all images from the intermediateDir
intermediateDir.get().asFile.walkTopDown().forEach { file ->
if (KnownImageFileExtensions.contains(file.extension)) {
file.delete()
}
}

// Remove all files not in the results from the outputDir
val removingFiles: MutableSet<String> = outputDir.get().asFile
.listFiles()
Expand Down

0 comments on commit 2fb6d83

Please sign in to comment.