Template:IO Restrictions: Difference between revisions
Jump to navigation
Jump to search
m (Link fix: IORules → IOrules) |
mNo edit summary |
||
Line 1: | Line 1: | ||
<font color="red"><b>Note:</b> All FlightGear disk I/O handled via [[Nasal]] and/or fgcommands, is subject to validation via [[IOrules]]. This includes the '''SGPath''' bindings in 2.99+</font> | <font color="red"><b>Note:</b> All FlightGear disk I/O handled via [[Nasal]] and/or fgcommands, is subject to validation via [[IOrules]]. This includes the '''SGPath''' bindings in FlightGear 2.99+</font> | ||
However, unlike [[$FG_ROOT]] [[$FG_HOME]] is generally accessible for writing: | However, unlike [[$FG_ROOT]], [[$FG_HOME]] is generally accessible for writing, consider this example: | ||
<syntaxhighlight lang="nasal"> | <syntaxhighlight lang="nasal"> | ||
# come up with a path in $FG_HOME, inside the Export sub folder, file name is test.xml | |||
var path = getprop("/sim/fg-home") ~ "/Export/test.xml"; | var path = getprop("/sim/fg-home") ~ "/Export/test.xml"; | ||
# use the write_properties() helper in io.nas, which is a wrapper for the savexml fgcommand (see README.commands) | |||
io.write_properties(path, "/sim"); | io.write_properties(path, "/sim"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
This will dump the sub branch of the '''/sim''' property tree into $FG_HOME/Export/test.xml | |||
For additional examples, see $FG_ROOT/Nasal/io.nas | For additional examples, see $FG_ROOT/Nasal/io.nas | ||
To learn more about PropertyList processing via loadxml and savexml, please see $FG_ROOT/Docs/README.commands | To learn more about PropertyList processing via loadxml and savexml, please see $FG_ROOT/Docs/README.commands |
Revision as of 15:18, 20 December 2013
Note: All FlightGear disk I/O handled via Nasal and/or fgcommands, is subject to validation via IOrules. This includes the SGPath bindings in FlightGear 2.99+
However, unlike $FG_ROOT, $FG_HOME is generally accessible for writing, consider this example:
# come up with a path in $FG_HOME, inside the Export sub folder, file name is test.xml
var path = getprop("/sim/fg-home") ~ "/Export/test.xml";
# use the write_properties() helper in io.nas, which is a wrapper for the savexml fgcommand (see README.commands)
io.write_properties(path, "/sim");
This will dump the sub branch of the /sim property tree into $FG_HOME/Export/test.xml
For additional examples, see $FG_ROOT/Nasal/io.nas To learn more about PropertyList processing via loadxml and savexml, please see $FG_ROOT/Docs/README.commands