Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add support for older os version sketchbook location #61

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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