wookietreiber / scala-xdg   0.1.0

BSD 3-clause "New" or "Revised" License GitHub

freedesktop.org standards for Scala

Scala versions: 2.12 2.11 2.10
Scala.js versions: 0.6
Scala Native versions: 0.3

freedesktop.org for Scala

Build Status Codacy Badge

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

Base Directory Specification

Latest version Scaladoc

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