Skip to content

Commit

Permalink
fix: add support for older os version sketchbook location
Browse files Browse the repository at this point in the history
  • Loading branch information
mingness committed Dec 1, 2024
1 parent 24f8753 commit c86906c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,28 @@ version = "1.0.0"
// Depending on your OS, the code below should set the correct location, if you are using a Mac,
// Windows, or Linux machine.
// If you run the Gradle task deployToProcessingSketchbook, and you do not see your library
// in the contributions manager, then one possible cause could be the sketchbook location
// listed as a contributed library, then one possible cause could be the sketchbook location
// is wrong. You can check the sketchbook location in your Processing application preferences.
var sketchbookLocation = ""
val userHome = System.getProperty("user.home")
val currentOS = OperatingSystem.current()
if(currentOS.isMacOsX) {
sketchbookLocation = "$userHome/Documents/Processing/sketchbook"
sketchbookLocation = if (File("$userHome/Documents/Processing/sketchbook").isDirectory) {
"$userHome/Documents/Processing/sketchbook"
} else {
"$userHome/Documents/Processing"
}
} else if(currentOS.isWindows) {
sketchbookLocation = "$userHome/My Documents/Processing/sketchbook"
val docsFolder = if (File("$userHome/My Documents").isDirectory) {
"$userHome/My Documents"
} else {
"$userHome/Documents"
}
sketchbookLocation = if (File(docsFolder,"Processing/sketchbook").isDirectory) {
"$docsFolder/Processing/sketchbook"
} else {
"$docsFolder/Processing"
}
} else {
sketchbookLocation = "$userHome/sketchbook"
}
Expand Down

0 comments on commit c86906c

Please sign in to comment.