[settings] filter modules' settings with target attribute like regular settings

This commit is contained in:
Gautier Hattenberger
2016-02-02 18:26:38 +01:00
parent fc8ab48ddc
commit f8145a2ba1
3 changed files with 22 additions and 2 deletions
+12 -1
View File
@@ -213,7 +213,18 @@ let is_element_unselected = fun ?(verbose=false) target modules name ->
| "module" ->
let unselected = List.for_all (fun m -> m.file <> name) modules in
if unselected && verbose then
begin Printf.printf "Info: module '%s' unloaded for target '%s'\n" name target; flush stdout end;
begin Printf.printf "Info: module '%s' unloaded for target '%s'\n" name target; flush stdout end
else begin
if verbose then
(* display possible unloading of settings when the module itself is loaded *)
List.iter (fun n ->
let tag = Xml.tag n
and targets = ExtXml.attrib_or_default n "target" "" in
let valid = test_targets target (Str.split (Str.regexp "|") targets) in
if tag = "settings" && not (targets = "") && not valid then
begin Printf.printf "Info: settings of module '%s' unloaded for target '%s'\n" name target; flush stdout end;
) (Xml.children xml)
end;
unselected
| _ -> false
with _ -> false