Package dev.dirs
Class BaseDirectories
- java.lang.Object
-
- dev.dirs.BaseDirectories
-
public final class BaseDirectories extends java.lang.ObjectBaseDirectoriesprovides paths of user-invisible standard directories, following the conventions of the operating system the library is running on.To compute the location of cache, config or data directories for individual projects or applications, use
ProjectDirectoriesinstead.Examples
All examples on this page are computed with a user named Alice.
Example of
ProjectDirectories.configDirvalue in different operating systems:- Linux/BSD:
/home/alice/.config - macOS:
/Users/Alice/Library/Preferences - Windows:
C:\Users\Alice\AppData\Roaming
- Linux/BSD:
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringcacheDirReturns the path to the user's cache directory.java.lang.StringconfigDirReturns the path to the user's configuration directory.java.lang.StringdataDirReturns the path to the user's data directory.java.lang.StringdataLocalDirReturns the path to the user's local data directory.java.lang.StringexecutableDirReturns the path to the user's executable directory.java.lang.StringhomeDirReturns the path to the user's home directory.java.lang.StringpreferenceDirReturns the path to the user's preference directory.java.lang.StringruntimeDirReturns the path to the user's runtime directory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static BaseDirectoriesget()Creates a newBaseDirectoriesinstance.inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
homeDir
public final java.lang.String homeDir
Returns the path to the user's home directory.
Platform Value Example Linux/BSD $HOME/home/alice macOS $HOME/Users/Alice Windows {FOLDERID_Profile}C:\Users\Alice\
-
cacheDir
public final java.lang.String cacheDir
Returns the path to the user's cache directory.
Platform Value Example Linux/BSD $XDG_CACHE_HOMEor$HOME/.cache/home/alice/.cache macOS $HOME/Library/Caches/Users/Alice/Library/Caches Windows {FOLDERID_LocalAppData}\cacheC:\Users\Alice\AppData\Local
-
configDir
public final java.lang.String configDir
Returns the path to the user's configuration directory.
Platform Value Example Linux/BSD $XDG_CONFIG_HOMEor$HOME/.config/home/alice/.config macOS $HOME/Library/Application Support/Users/Alice/Library/Application Support Windows {FOLDERID_RoamingAppData}C:\Users\Alice\AppData\Roaming
-
dataDir
public final java.lang.String dataDir
Returns the path to the user's data directory.
Platform Value Example Linux/BSD $XDG_DATA_HOMEor$HOME/.local/share/home/alice/.local/share macOS $HOME/Library/Application Support/Users/Alice/Library/Application Support Windows {FOLDERID_RoamingAppData}C:\Users\Alice\AppData\Roaming
-
dataLocalDir
public final java.lang.String dataLocalDir
Returns the path to the user's local data directory.
Platform Value Example Linux/BSD $XDG_DATA_HOMEor$HOME/.local/share/home/alice/.local/share macOS $HOME/Library/Application Support/Users/Alice/Library/Application Support Windows {FOLDERID_LocalAppData}C:\Users\Alice\AppData\Local
-
executableDir
public final java.lang.String executableDir
Returns the path to the user's executable directory.
Platform Value Example Linux/BSD $XDG_BIN_HOMEor$XDG_DATA_HOME/../bin or$HOME/.local/bin/home/alice/.local/bin macOS – nullWindows – null
-
preferenceDir
public final java.lang.String preferenceDir
Returns the path to the user's preference directory.
Platform Value Example Linux/BSD $XDG_CONFIG_HOMEor$HOME/.config/home/alice/.config macOS $HOME/Library/Preferences/Users/Alice/Library/Preferences Windows {FOLDERID_RoamingAppData}C:\Users\Alice\AppData\Roaming
-
runtimeDir
public final java.lang.String runtimeDir
Returns the path to the user's runtime directory.
Platform Value Example Linux/BSD $XDG_RUNTIME_DIR/run/user/1001/ macOS – nullWindows – null
-
-
Method Detail
-
get
public static BaseDirectories get()
Creates a newBaseDirectoriesinstance.The instance is an immutable snapshot of the state of the system at the time this method is invoked. Subsequent changes to the state of the system are not reflected in instances created prior to such a change.
- Returns:
- A new
BaseDirectoriesinstance.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-