This repository has been archived on 2022-05-05. You can view files and clone it, but cannot push or open issues or pull requests.
azh/cfg.d

25 lines
469 B
D

module azh.cfg;
import std.stdio;
import std.regex;
string[string] readConfigFile(string path)
{
auto file = File(path, "r");
string[string] properties;
auto p_property = regex(r"^(\w+) *= *(.+)$", "m");
while (!file.eof())
{
string line = file.readln();
auto m = matchFirst(line, p_property);
if (m)
{
auto property = m[1];
auto value = m[2];
properties[property] = value;
}
}
file.close();
return properties;
}