Package org.savantbuild.util
Class SavantPaths
java.lang.Object
org.savantbuild.util.SavantPaths
Resolves Savant directory paths using XDG Base Directory conventions and handles migration from the legacy ~/.savant/
directory layout.
XDG mapping:
- Cache → $XDG_CACHE_HOME/savant (default ~/.cache/savant)
- Config → $XDG_CONFIG_HOME/savant (default ~/.config/savant)
-
Method Summary
-
Method Details
-
get
Returns the default singleton instance that uses the real home directory and environment.- Returns:
- The default SavantPaths instance.
-
cacheDir
- Returns:
- The Savant cache directory: $XDG_CACHE_HOME/savant or ~/.cache/savant
-
configDir
- Returns:
- The Savant config directory: $XDG_CONFIG_HOME/savant or ~/.config/savant
-
migrate
Migrates from the legacy ~/.savant/ directory to XDG locations. This method is idempotent — it only runs once per instance.Migration rules:
- If XDG dirs exist AND ~/.savant exists → warn that ~/.savant is being ignored
- If XDG dirs don't exist AND ~/.savant exists → move contents to XDG locations
- If neither exists → no-op (fresh install)
- Parameters:
output- The output for printing migration messages.
-