Skip to content

a tiny library that provides config/cache/data paths, following the respective conventions on Linux, macOS, BSD and Windows - coursier fork

License

Notifications You must be signed in to change notification settings

coursier/directories-jvm

 
 

Repository files navigation

Maven Central API documentation CI License: MPL-2.0

directories-jvm (Coursier fork)

Fork of of the dirs-dev/directories-jvm project, with coursier-specific changes

Compared to the upstream project, this fork:

  • still supports JDK 8
  • offers to use JNI rather than shelling out to a PowerShell script to call Windows APIs with JDK < 23
  • contains a number of fixes for Windows

How to use

Add dependency

Mill

def ivyDeps = Agg(
  ivy"io.get-coursier.util:directories:0.1.2"
)

Scala CLI

//> using dep io.get-coursier.util:directories:0.1.2

API

import dev.dirs.ProjectDirectories
val projDirs = ProjectDirectories.from(null, null, "MyApp")
projDirs.configDir // "/Users/name/Library/Application Support/MyApp"
projDirs.preferenceDir // "/Users/name/Library/Preferences/MyApp"
// ...

How to use with JNI fallback on JDK < 23

Add dependency

Mill

def ivyDeps = Agg(
  ivy"io.get-coursier.util:directories-jni:0.1.2"
)

Scala CLI

//> using dep io.get-coursier.util:directories-jni:0.1.2

API

import dev.dirs.ProjectDirectories
import dev.dirs.jni.WindowsJni
val projDirs = ProjectDirectories.from(null, null, "MyApp", WindowsJni.getJdkAwareSupplier())
projDirs.configDir // "/Users/name/Library/Application Support/MyApp"
projDirs.preferenceDir // "/Users/name/Library/Preferences/MyApp"
// ...

About

a tiny library that provides config/cache/data paths, following the respective conventions on Linux, macOS, BSD and Windows - coursier fork

Resources

License

Stars

Watchers

Forks

Languages

  • Java 78.3%
  • Shell 8.9%
  • Batchfile 7.0%
  • Scala 5.8%