Package org.jdrupes.vmoperator.util
Class FsdUtils
java.lang.Object
org.jdrupes.vmoperator.util.FsdUtils
Utilities to access configurable file system directories.
Based on the FHS and the XDG Base Directory Specification.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PathAdds a directory with the user’s name to the path.static PathconfigHome(String appName) Returns the config home.static PathReturns the data home.findConfigFile(String appName, String filename) Find a configuration file.static PathruntimeDir(String appName) Returns the runtime directory.static PathReturns the state directory.static PathtmpDir()Returns the directory for temporary storage.static PathuserHome()Returns the real home directory of the user or, if not available, a sub directory intmpDir()with the user’s name.
-
Constructor Details
-
FsdUtils
public FsdUtils()
-
-
Method Details
-
addUser
Adds a directory with the user’s name to the path.If such a directory does not exist yet, creates it. If this file or the directory is not writable, return the given path.
- Parameters:
path- the path- Returns:
- the path
-
tmpDir
Returns the directory for temporary storage.- Returns:
- the path
-
userHome
Returns the real home directory of the user or, if not available, a sub directory intmpDir()with the user’s name.- Returns:
- the path
-
dataHome
Returns the data home.- Parameters:
appName- the application name- Returns:
- the path
-
configHome
Returns the config home.- Parameters:
appName- the application name- Returns:
- the path
-
stateHome
Returns the state directory.- Parameters:
appName- the application name- Returns:
- the path
-
runtimeDir
Returns the runtime directory.- Parameters:
appName- the application name- Returns:
- the path
-
findConfigFile
Find a configuration file.The given filename is searched for in:
- the current working directory,
- the
configHome(String) - the subdirectory
appNameof/etc/opt - the subdirectory
appNameof/etc
- Parameters:
appName- the application namefilename- the filename- Returns:
- the optional
-