Standard Paths is a small library which provides cross platform access to the common directories such as AppData, Desktop or tmp.
Target JVM version is 8.
- All major distributions:
Windows,Linux,MacOS(not yet implemented) - Ease of use
- NIO-based
- Lightweight (~10kb)
The package has jna-platform as transitive dependency (~2.5mb).
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.
Maven:
<dependency>
<groupId>io.github.sanyarnd</groupId>
<artifactId>standard-paths</artifactId>
<version>1.0.2</version>
</dependency>Gradle:
compile 'io.github.sanyarnd:standard-paths:1.0.2'Standalone jars are available on releases page.
More download options available in Bintray repository.
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.
Windows:%USERPROFILE%/AppData/LocalLinux:$XDG_CACHE_HOME(default:$HOME/.cache)
Windows:%USERPROFILE%/AppData/LocalLinux:$XDG_CONFIG_HOME(default:$HOME/.config)
Windows:%USERPROFILE%/AppData/RoamingLinux:$HOME/.local/share
Windows:%USERPROFILE%/AppData/LocalLinux:$HOME/.local/share
Windows:%USERPROFILE%/AppData/Local/TempLinux:/tmp
Windows:%USERPROFILE%Linux:~
desktop:
Windows:%USERPROFILE%/DesktopLinux:~/Desktop
documents:
Windows:%USERPROFILE%/DocumentsLinux:~/Documents
downloads:
Windows:%USERPROFILE%/DownloadsLinux:~/Downloads
music:
Windows:%USERPROFILE%/MusicLinux:~/Music
pictures:
Windows:%USERPROFILE%/PicturesLinux:~/Pictures
videos:
Windows:%USERPROFILE%/VideosLinux:~/Videos
See CHANGELOG.md.