loadOrSaveConfiguration

fun loadOrSaveConfiguration(defaultSupplier: () -> T): T(source)

Reads the configuration from configurationFile if it exists. If it doesn't exist, it returns the supplied default configuration, and writes it to configurationFile. This doesn't handle IO errors (like inaccessible file), malformed JSON, or encoding and decoding failures.

Return

The configuration from the file, or the default configuration, if the file doesn't exist

Parameters

defaultSupplier

The default configuration supplier