mirror of https://github.com/buggins/dlangide.git
refactor project configurations reading code
This commit is contained in:
parent
e77286941c
commit
e9544d2f83
|
@ -259,20 +259,18 @@ struct ProjectConfiguration {
|
||||||
static ProjectConfiguration[string] load(Setting s)
|
static ProjectConfiguration[string] load(Setting s)
|
||||||
{
|
{
|
||||||
ProjectConfiguration[string] res = [DEFAULT_NAME: DEFAULT];
|
ProjectConfiguration[string] res = [DEFAULT_NAME: DEFAULT];
|
||||||
if(s.map is null || "configurations" !in s.map || s.map["configurations"].array is null)
|
Setting configs = s.objectByPath("configurations");
|
||||||
|
if(configs is null || configs.type != SettingType.ARRAY)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
foreach(conf; s.map["configurations"].array)
|
foreach(conf; configs) {
|
||||||
{
|
if(!conf.isObject) continue;
|
||||||
if(conf.map is null || "name" !in conf.map) continue;
|
|
||||||
Type t = Type.Default;
|
Type t = Type.Default;
|
||||||
if("targetType" in conf.map) {
|
if(auto typeName = conf.getString("targetType"))
|
||||||
t = parseType(conf.map["targetType"].str);
|
t = parseType(typeName);
|
||||||
}
|
if (string confName = conf.getString("name"))
|
||||||
string confName = conf.map["name"].str;
|
|
||||||
res[confName] = ProjectConfiguration(confName, t);
|
res[confName] = ProjectConfiguration(confName, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue