Skip to content

better-files + lightbend/config + XDG Base Directory Specification

License

Notifications You must be signed in to change notification settings

esamson/better-xdg

Repository files navigation

better-xdg

A Scala combo of better-files + lightbend/config + XDG Base Directory Specification.

Add to your dependencies.

Latest release is available from Maven Central.

version

libraryDependencies += "ph.samson.xdg" %% "basedir" % version

Use in your code.

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")
  }
}

About

better-files + lightbend/config + XDG Base Directory Specification

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages