Package utility.application
Class ApplicationUtilities
java.lang.Object
utility.application.ApplicationUtilities
Utility class for default application things.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name of system property used to override the location of the user cache directorystatic final String
Name of system property used to override the location of the user settings directorystatic final String
Name of system property used to override the location of the user temporary directory -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection
<ResourceFile> Searches for default application root directories.static File
getDefaultUserCacheDir
(ApplicationProperties applicationProperties) Gets the application's default user cache directory.static File
getDefaultUserSettingsDir
(ApplicationProperties applicationProperties, ResourceFile installationDirectory) Gets the application's default user settings directory.static File
getDefaultUserTempDir
(String applicationName) Gets the application's default user temp directory.static File
getLegacyUserSettingsDir
(ApplicationProperties applicationProperties, ResourceFile installationDirectory) Gets the application's legacy (pre-Ghida 11.1) user settings directory.static String
normalizeApplicationName
(String applicationName) Normalizes the application name by removing spaces and converting to lower case
-
Field Details
-
PROPERTY_TEMP_DIR
Name of system property used to override the location of the user temporary directory- See Also:
-
PROPERTY_CACHE_DIR
Name of system property used to override the location of the user cache directory- See Also:
-
PROPERTY_SETTINGS_DIR
Name of system property used to override the location of the user settings directory- See Also:
-
-
Constructor Details
-
ApplicationUtilities
public ApplicationUtilities()
-
-
Method Details
-
findDefaultApplicationRootDirs
Searches for default application root directories.- Returns:
- A collection of discovered application root directories (could be empty).
-
getDefaultUserTempDir
public static File getDefaultUserTempDir(String applicationName) throws FileNotFoundException, IOException Gets the application's default user temp directory.NOTE: This method creates the directory if it does not exist.
- Parameters:
applicationName
- The application name.- Returns:
- The application's default user temp directory. The returned
File
will represent an absolute path. - Throws:
FileNotFoundException
- if the absolute path of the user temp directory could not be determined.IOException
- if the user temp directory could not be created.
-
getDefaultUserCacheDir
public static File getDefaultUserCacheDir(ApplicationProperties applicationProperties) throws FileNotFoundException, IOException Gets the application's default user cache directory.NOTE: This method creates the directory if it does not exist.
- Parameters:
applicationProperties
- The application properties.- Returns:
- The application's default user cache directory. The returned
File
will represent an absolute path. - Throws:
FileNotFoundException
- if the absolute path of the user cache directory could not be determined.IOException
- if the user cache directory could not be created.
-
getDefaultUserSettingsDir
public static File getDefaultUserSettingsDir(ApplicationProperties applicationProperties, ResourceFile installationDirectory) throws FileNotFoundException, IOException Gets the application's default user settings directory.NOTE: This method creates the directory if it does not exist.
- Parameters:
applicationProperties
- The application properties.installationDirectory
- The application installation directory.- Returns:
- The application's default user settings directory. The returned
File
will represent an absolute path. - Throws:
FileNotFoundException
- if the absolute path of the user settings directory could not be determined.IOException
- if the user settings directory could not be created.
-
getLegacyUserSettingsDir
public static File getLegacyUserSettingsDir(ApplicationProperties applicationProperties, ResourceFile installationDirectory) throws FileNotFoundException Gets the application's legacy (pre-Ghida 11.1) user settings directory.NOTE: This method does not create the directory.
- Parameters:
applicationProperties
- The application properties.installationDirectory
- The application installation directory.- Returns:
- The application's legacy user settings directory. The returned
File
will represent an absolute path. - Throws:
FileNotFoundException
- if the absolute path of the legacy user settings directory could not be determined.
-
normalizeApplicationName
Normalizes the application name by removing spaces and converting to lower case- Parameters:
applicationName
- The application name- Returns:
- The normalized application name
-