Skip to content

Commit d7c6aeb

Browse files
committed
Also copy Untitled sketches
1 parent 24cb4f4 commit d7c6aeb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/src/processing/app/gradle/GradleService.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ class GradleService(
8484
private fun setupGradle(): MutableList<String> {
8585
val sketch = sketch ?: throw IllegalStateException("Sketch is not set")
8686

87-
val sketchFolder = if(sketch.isReadOnly) workingDir.resolve("sketch").toFile() else sketch.folder
88-
if(sketch.isReadOnly){
87+
val copy = sketch.isReadOnly || sketch.isUntitled
88+
89+
val sketchFolder = if(copy) workingDir.resolve("sketch").toFile() else sketch.folder
90+
if(copy){
8991
// If the sketch is read-only, we copy it to the working directory
9092
// This allows us to run the sketch without modifying the original files
9193
sketch.folder.copyRecursively(sketchFolder, overwrite = true)
@@ -108,7 +110,7 @@ class GradleService(
108110
val variables = mapOf(
109111
"group" to System.getProperty("processing.group", "org.processing"),
110112
"version" to Base.getVersionName(),
111-
"sketchFolder" to sketch.folder.absolutePath,
113+
"sketchFolder" to sketchFolder,
112114
"sketchbook" to Base.getSketchbookFolder(),
113115
"workingDir" to workingDir.toAbsolutePath().toString(),
114116
"settings" to Platform.getSettingsFolder().absolutePath.toString(),
@@ -123,7 +125,6 @@ class GradleService(
123125
//"window.color" to "0xFF000000", // TODO: Implement
124126
//"stop.color" to "0xFF000000", // TODO: Implement
125127
"stop.hide" to false, // TODO: Implement
126-
"sketch.folder" to sketchFolder,
127128
)
128129
val repository = Platform.getContentFile("repository").absolutePath.replace("""\""", """\\""")
129130

@@ -191,7 +192,7 @@ class GradleService(
191192

192193
val arguments = mutableListOf("--init-script", initGradle.toAbsolutePath().toString())
193194
if (!Base.DEBUG) arguments.add("--quiet")
194-
if(sketch.isReadOnly){
195+
if(copy){
195196
arguments += listOf("--project-dir", sketchFolder.absolutePath)
196197
}
197198
arguments.addAll(variables.entries

0 commit comments

Comments
 (0)