Skip to content

Commit 59becd4

Browse files
committed
Use sane way to delete files
1 parent cec7282 commit 59becd4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/scala/sbtprotoc/ProtocPlugin.scala

+9-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,15 @@ object ProtocPlugin extends AutoPlugin {
439439
val targetPaths = targets.map(_.outputPath).toSet
440440

441441
if (deleteTargetDirectory) {
442-
targetPaths.foreach(IO.delete)
442+
443+
targetPaths.foreach(targetPath => {
444+
def fileList = (targetPath ** "*.scala").get().toSet[File]
445+
fileList.foreach { f =>
446+
if (IO.read(f).startsWith("// Generated by the Scala Plugin for the Protocol Buffer Compiler.")) {
447+
IO.delete(f)
448+
}
449+
}
450+
})
443451
}
444452

445453
targets

0 commit comments

Comments
 (0)