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.*
20
20
import javax.swing.SwingUtilities
21
21
import javax.swing.event.DocumentEvent
22
22
import javax.swing.event.DocumentListener
23
+ import kotlin.io.path.deleteIfExists
23
24
import kotlin.io.path.writeText
24
25
25
26
// TODO: Remove dependency on editor (editor is not mockable, or move editor away from JFrame)
@@ -140,14 +141,18 @@ class GradleService(val editor: Editor) {
140
141
141
142
private fun setupGradle (): MutableList <String > {
142
143
val unsaved = editor.sketch.code
143
- .filter { it.isModified }
144
144
.map { code ->
145
145
val file = workingDir.resolve(" unsaved/${code.fileName} " )
146
146
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
149
155
}
150
- // TODO: Delete unsaved file if not modified
151
156
152
157
val group = System .getProperty(" processing.group" , " org.processing" )
153
158
You can’t perform that action at this time.
0 commit comments