ConfigHandler

open class ConfigHandler<Config>

Config handler for easy managing of config files with the json format.

Parameters

<Config>

A simple getter and setter class containing all your config values.

Constructors

Link copied to clipboard
open fun ConfigHandler(defaultConfig: Config, path: String)
Create a config handler.
Link copied to clipboard
open fun ConfigHandler(defaultConfig: Config, path: String, writeDefaultConfigAutomatically: Boolean)
Create a config handler.

Functions

Link copied to clipboard
open fun checkIfExists(): Boolean
Check if the config file is already existing.
Link copied to clipboard
open fun delete(): Boolean
Delete the file.
Link copied to clipboard
open fun getSystemConfigFolder(projectName: String): String
Get an path to an folder where you can store system wide configurations.
Link copied to clipboard
open fun getUserConfigFolder(): String
open fun getUserConfigFolder(projectName: String): String
Get an path to an folder where you can store user configurations.
Link copied to clipboard
open fun loadConfig(): Config
Load the config.
Link copied to clipboard
open fun saveDefaultConfig()
Save the default config in the config file.
Link copied to clipboard
open fun storeConfig(config: Config)
Save the config object as an JSON string in the config file.

Properties

Link copied to clipboard
private val defaultConfig: Config
Link copied to clipboard
private val file: File
Link copied to clipboard
private val path: String