freedesktop.org for Scala

Codacy Badge

Libraries for Scala to access the standards defined by freedesktop.org (formerly X Desktop Group).

Base Directory Specification

The basedir sub-project contains an implementation of the Base Directory Specification.

import org.freedesktop._

// returns path in user config directory
// ~/.config/git/config
val a: String = basedir.config("git", "config")

// creates and returns in user config directory
// ~/.config/app.conf
val b: String = basedir.config.create("app.conf")

// locates first existing in all (including global) base directories
// could be ~/.config/awesome/rc.lua
// or could be /etc/xdg/awesome/rc.lua if user does not have one
val c: Option[String] = basedir.config.locate("awesome", "rc.lua")

// same works with cache, data and runtime base directories