Skip to content

Commit c86906c

Browse files
committed
fix: add support for older os version sketchbook location
1 parent 24f8753 commit c86906c

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

build.gradle.kts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,28 @@ version = "1.0.0"
5050
// Depending on your OS, the code below should set the correct location, if you are using a Mac,
5151
// Windows, or Linux machine.
5252
// If you run the Gradle task deployToProcessingSketchbook, and you do not see your library
53-
// in the contributions manager, then one possible cause could be the sketchbook location
53+
// listed as a contributed library, then one possible cause could be the sketchbook location
5454
// is wrong. You can check the sketchbook location in your Processing application preferences.
5555
var sketchbookLocation = ""
5656
val userHome = System.getProperty("user.home")
5757
val currentOS = OperatingSystem.current()
5858
if(currentOS.isMacOsX) {
59-
sketchbookLocation = "$userHome/Documents/Processing/sketchbook"
59+
sketchbookLocation = if (File("$userHome/Documents/Processing/sketchbook").isDirectory) {
60+
"$userHome/Documents/Processing/sketchbook"
61+
} else {
62+
"$userHome/Documents/Processing"
63+
}
6064
} else if(currentOS.isWindows) {
61-
sketchbookLocation = "$userHome/My Documents/Processing/sketchbook"
65+
val docsFolder = if (File("$userHome/My Documents").isDirectory) {
66+
"$userHome/My Documents"
67+
} else {
68+
"$userHome/Documents"
69+
}
70+
sketchbookLocation = if (File(docsFolder,"Processing/sketchbook").isDirectory) {
71+
"$docsFolder/Processing/sketchbook"
72+
} else {
73+
"$docsFolder/Processing"
74+
}
6275
} else {
6376
sketchbookLocation = "$userHome/sketchbook"
6477
}

0 commit comments

Comments
 (0)