loadSettings

Load settings. Will create settings file by default. Searches all system-wide settings dirs as well as the user's settings dir, and loads the first file found.

loadSettings
(
T
)
(
string name
,
string filename = settingsFilename
)

Parameters

T

Type of settings struct to load

name string

Subdirectory of settings dir to save config to. Created if nonexistent.

filename string

The filename the settings will be loaded from.

Examples

struct Settings {
	bool blah;
	string text;
	string[] texts;
}
auto settings = loadSettings!Settings("testapp");
settings.texts = ["a", "b", "c"];
saveSettings(settings, "testapp");

auto reloadedSettings = loadSettings!Settings("testapp");
assert(reloadedSettings == settings);
assert(reloadedSettings.texts == ["a", "b", "c"]);

Meta