Class LocalStorage
- java.lang.Object
-
- ch.sahits.game.openpatrician.utilities.LocalStorage
-
@Service public class LocalStorage extends java.lang.Object
This service class provides methods to handle common stuff in the .OpenPatrician directory.- Author:
- Andi Hotz, (c) Sahits GmbH, 2016 Created on Feb 13, 2016
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APP_CONF_DIR
static java.lang.String
PLUGIN_DIR
private static java.lang.String
SAVEGAME_DIR
-
Constructor Summary
Constructors Constructor Description LocalStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
createNonExistingDirectory(java.io.File f)
java.io.File
getAppFolderDirectory()
Get the File identifying the application folder in the user home directory.java.io.File
getPluginDirectory()
Retrieve the plugin directory.java.lang.String
getPluginDirectoryPath()
Retrieve the plugin directory path.java.lang.String
getPluginTypeDirecotryPath(EPluginType type)
Extract the path for the plugin based on the plugin type and the file name of the plugin zip archive.java.io.File
getSavegameDirectory()
Retrieve the savegame directory.
-
-
-
Field Detail
-
APP_CONF_DIR
public static final java.lang.String APP_CONF_DIR
- See Also:
- Constant Field Values
-
SAVEGAME_DIR
private static final java.lang.String SAVEGAME_DIR
-
PLUGIN_DIR
public static final java.lang.String PLUGIN_DIR
-
-
Method Detail
-
getAppFolderDirectory
public java.io.File getAppFolderDirectory()
Get the File identifying the application folder in the user home directory. If the folder does not exist, it will be created.- Returns:
- File pointing to the application storage directory.
-
getSavegameDirectory
public java.io.File getSavegameDirectory()
Retrieve the savegame directory. If it does not exist it will be created.- Returns:
- File pointing to the savegame directory.
-
getPluginDirectory
public java.io.File getPluginDirectory()
Retrieve the plugin directory. If it does not exist it will be created.- Returns:
- File pointing to the plugin directory.
-
getPluginDirectoryPath
public java.lang.String getPluginDirectoryPath()
Retrieve the plugin directory path. There is no check if the directory exists.- Returns:
- path to the plugin directory.
-
getPluginTypeDirecotryPath
public java.lang.String getPluginTypeDirecotryPath(EPluginType type)
Extract the path for the plugin based on the plugin type and the file name of the plugin zip archive. If the directory does not exist, create it.- Parameters:
type
- of the plugin- Returns:
- directory path of the plugin type.
-
createNonExistingDirectory
private void createNonExistingDirectory(java.io.File f)
-
-