Skip to content

Commit

Permalink
Fix package and cache paths on linux by not relying on XDG environmen…
Browse files Browse the repository at this point in the history
…t variables which can be missing
  • Loading branch information
tamaracha committed Oct 22, 2024
1 parent 9ebb2e4 commit 07c5cad
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ class GradleTypstPlugin : Plugin<Project> {
val dataDir = if (currentOs.isMacOsX) {
project.layout.projectDirectory.dir(project.providers.systemProperty("user.home")).map { it.dir("Library/Application Support") }
} else if (currentOs.isLinux) {
project.layout.projectDirectory.dir(project.providers.environmentVariable("XDG_DATA_HOME"))
project.layout.projectDirectory.dir(project.providers.systemProperty("user.home")).map { it.dir(".local/share") }
} else {
project.layout.projectDirectory.dir(project.providers.environmentVariable("APPDATA"))
}
val cacheDir = if (currentOs.isMacOsX) {
project.layout.projectDirectory.dir(project.providers.systemProperty("user.home")).map { it.dir("Library/Caches") }
} else if (currentOs.isLinux) {
project.layout.projectDirectory.dir(project.providers.environmentVariable("XDG_CACHE_HOME"))
project.layout.projectDirectory.dir(project.providers.systemProperty("user.home")).map { it.dir(".cache") }
} else {
project.layout.projectDirectory.dir(project.providers.environmentVariable("LOCALAPPDATA"))
}
Expand Down

0 comments on commit 07c5cad

Please sign in to comment.