Package eu.svjatoslav.commons.file
Class CommonPathResolver
java.lang.Object
eu.svjatoslav.commons.file.CommonPathResolver
Resolves common system paths and directories.
This utility class provides static methods to obtain common file system paths that are frequently needed in applications, such as the user's home directory, configuration directories, or temporary directories.
Currently provides:
- User home directory - the personal directory of the current user
Example usage:
File homeDir = CommonPathResolver.getHomeDirectory();
File configFile = new File(homeDir, ".myapp/config.properties");
This class is designed to be extended with additional common path resolution methods as needed.
-
Method Summary
-
Method Details
-
getHomeDirectory
Returns the current user's home directory.This is typically the personal directory of the logged-in user, such as:
- On Linux/Mac: "/home/username" or "/Users/username"
- On Windows: "C:\\Users\\username"
This is a convenient location for storing user-specific configuration files, documents, and application data.
Example usage:
File home = CommonPathResolver.getHomeDirectory(); System.out.println("Home directory: " + home.getAbsolutePath()); // Create an application config directory File configDir = new File(home, ".myapp"); configDir.mkdirs();- Returns:
- a File object representing the user's home directory. The directory typically exists and is readable/writable by the current user.
-