Skip to content

Latest commit

 

History

History
101 lines (75 loc) · 2.77 KB

README.md

File metadata and controls

101 lines (75 loc) · 2.77 KB

Standard Paths

Build Status Coverage

Standard Paths is a small library which provides cross platform access to the common directories such as AppData, Desktop or tmp.

Features

  • All major distributions: Windows, Linux, MacOS (not yet implemented)
  • Ease of use
  • NIO-based
  • Lightweight (~10kb)
  • JDK8+ support

The package has jna-platform as transitive dependency (~2.5mb).

Quick Start

Access StandardPaths class and follow autocomplete suggestions:

Path home = StandardPaths.home();
Path cache = StandardPaths.cache();

Be aware that all StandardPaths methods might throw unchecked NoSuchPathException if it's impossible to obtain required path.

Download

Maven:

<dependency> 
    <groupId>io.github.sanyarnd</groupId> 
    <artifactId>standard-paths</artifactId>
    <version>1.0</version>
</dependency>

Gradle:

compile 'io.github.sanyarnd:standard-paths:1.0'

Standalone jars are available on releases page.

More download options available in Bintray repository.

Available paths (examples)

Paths below are mere examples.

Internal implementation will always do its best utilizing system API (WinAPI, freedesktop etc) and retrieve the real path.

More details can be found in JavaDocs.

Cache

  • Windows: %USERPROFILE%/AppData/Local
  • Linux: $XDG_CACHE_HOME (default: $HOME/.cache)

Config

  • Windows: %USERPROFILE%/AppData/Local
  • Linux: $XDG_CONFIG_HOME (default: $HOME/.config)

Data

  • Windows: %USERPROFILE%/AppData/Roaming
  • Linux: $HOME/.local/share

Local data

  • Windows: %USERPROFILE%/AppData/Local
  • Linux: $HOME/.local/share

Temp directory

  • Windows: %USERPROFILE%/AppData/Local/Temp
  • Linux: /tmp

Home

  • Windows: %USERPROFILE%
  • Linux: ~

Desktop

  • Windows: %USERPROFILE%/Desktop
  • Linux: ~/Desktop

Documents

  • Windows: %USERPROFILE%/Documents
  • Linux: ~/Documents

Downloads

  • Windows: %USERPROFILE%/Downloads
  • Linux: ~/Downloads

Music

  • Windows: %USERPROFILE%/Music
  • Linux: ~/Music

Pictures

  • Windows: %USERPROFILE%/Pictures
  • Linux: ~/Pictures

Videos

  • Windows: %USERPROFILE%/Videos
  • Linux: ~/Videos

Changelog

See CHANGELOG.md.