A Scala combo of better-files + lightbend/config + XDG Base Directory Specification.
Latest release is available from Maven Central.
libraryDependencies += "ph.samson.xdg" %% "basedir" % version
import ph.samson.xdg.basedir._
object MyApp {
def main(args: Array[String]): Unit = {
// Get the base data directory
val dataDir = data("my_app").get
// Get a file from the data directory
val dataFile = data("my_app").get("file")
// Lookup all files from data directories
val dataFiles = data("my_app").lookup("file")
// Load application.conf
val appConf = config("my_app").load
// Load other.conf
val otherConf = config("my_app").load("other.conf")
// Get a file from the cache directory
val cacheFile = cache("my_app").get("file")
// Runtime dir may not be available if $XDG_RUNTIME_DIR is not set
val runFile = runtime("my_app").get("file")
}
}