File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
app/src/processing/app/gradle Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import java.io.*
2020import javax.swing.SwingUtilities
2121import javax.swing.event.DocumentEvent
2222import javax.swing.event.DocumentListener
23+ import kotlin.io.path.deleteIfExists
2324import kotlin.io.path.writeText
2425
2526// TODO: Remove dependency on editor (editor is not mockable, or move editor away from JFrame)
@@ -140,14 +141,18 @@ class GradleService(val editor: Editor) {
140141
141142 private fun setupGradle (): MutableList <String > {
142143 val unsaved = editor.sketch.code
143- .filter { it.isModified }
144144 .map { code ->
145145 val file = workingDir.resolve(" unsaved/${code.fileName} " )
146146 file.parent.toFile().mkdirs()
147- file.writeText(code.documentText)
148- code.fileName
147+ // If tab is marked modified save it to the working directory
148+ // Otherwise delete the file
149+ if (code.isModified){
150+ file.writeText(code.documentText)
151+ }else {
152+ file.deleteIfExists()
153+ }
154+ return @map code.fileName
149155 }
150- // TODO: Delete unsaved file if not modified
151156
152157 val group = System .getProperty(" processing.group" , " org.processing" )
153158
You can’t perform that action at this time.
0 commit comments