alex
05/23/2019, 8:02 AMStandardPaths
provides the utility class with the most common system- and user- related directories.
Features
• All major distributions: Windows, Linux, MacOS (not yet, no access to MacOS right now)
• Ease of use
• NIO-based
• Lightweight (~10kb)
• JDK8+ support
Usage:
Path home = StandardPaths.home();
Path cache = StandardPaths.cache();
Someone mentioned AppDirs
library few weeks ago, I thought about contributing (few advanced methods of retrieving paths with WinAPI), but AppDirs
is JDK6+ based with WinXP support, while I'm trying to utilize JDK7 NIO as much as I could (e.g. Path
better than File
better than String
) with modern OSes in mind. API difference:
Path home = StandardPaths.dataLocal().resolve("<author>/<app>/<ver>")
vs
Path home = Paths.get(AppDirsFactory.getInstance().getUserDataDir("<app>", "<ver>", "<author>", true)));
elexx
05/24/2019, 8:13 AMalex
05/24/2019, 8:16 AM