Skip to content

Commit

Permalink
bugfix: update SqlSharedIndices XDG path with dev.dirs.ProjectDirecto…
Browse files Browse the repository at this point in the history
…ries
  • Loading branch information
untainsYD authored and tgodzik committed Sep 27, 2024
1 parent 6557240 commit fe3dc07
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ package scala.meta.internal.metals

import java.nio.file.Paths

import scala.util.Properties

import scala.meta.io.AbsolutePath

import dev.dirs.ProjectDirectories

object MetalsDirectories {
private val projectDirectories = ProjectDirectories.from(null, null, "metals")

def getMetalsDirectory: AbsolutePath = {
if (Properties.isLinux) {
Option(System.getenv("XDG_DATA_HOME"))
.map(xdg => Paths.get(xdg, "metals"))
.getOrElse(Paths.get(sys.props("user.home"), ".local", "share", "metals"))
} else {
Paths.get(sys.props("user.home"), ".metals")
}
}.toAbsolutePath
AbsolutePath(Paths.get(projectDirectories.dataDir))
}
}

class SqlSharedIndices
Expand Down

0 comments on commit fe3dc07

Please sign in to comment.