1
0
Fork 0

Extend IORules system to permit aircraft dirs.

This commit is contained in:
James Turner 2010-08-16 11:08:24 +01:00
parent 18549b4b69
commit 8fd716f2ca
2 changed files with 21 additions and 5 deletions

View file

@ -27,6 +27,7 @@
READ ALLOW $FG_ROOT/*
READ ALLOW $FG_HOME/*
READ ALLOW $FG_AIRCRAFT/*
WRITE ALLOW /tmp/*.xml
WRITE ALLOW $FG_HOME/*.sav

View file

@ -235,11 +235,26 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
var pattern = f[2];
foreach (var p; subvec(f, 3))
pattern ~= " " ~ p;
if (substr(pattern, 0, 9) == "$FG_ROOT/")
pattern = root ~ "/" ~ substr(pattern, 9);
elsif (substr(pattern, 0, 9) == "$FG_HOME/")
pattern = home ~ "/" ~ substr(pattern, 9);
append(f[0] == "READ" ? read_rules : write_rules, [pattern, f[1] == "ALLOW"]);
var rules = f[0] == "READ" ? read_rules : write_rules;
var allow = (f[1] == "ALLOW");
if (substr(pattern, 0, 13) == "$FG_AIRCRAFT/") {
var p = substr(pattern, 13);
var sim = props.globals.getNode("/sim");
foreach (var c; sim.getChildren("fg-aircraft")) {
pattern = c.getValue() ~ "/" ~ p;
append(rules, [pattern, allow]);
printlog("info", "IORules: appending ", pattern);
}
} else {
if (substr(pattern, 0, 9) == "$FG_ROOT/")
pattern = root ~ "/" ~ substr(pattern, 9);
elsif (substr(pattern, 0, 9) == "$FG_HOME/")
pattern = home ~ "/" ~ substr(pattern, 9);
append(rules, [pattern, allow]);
printlog("info", "IORules: appending ", pattern);
}
}
close(file);
return path;