25 lines
469 B
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;
|
|
}
|