diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 5f4419c4..205c4dae 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -158,7 +158,7 @@ setlistener("/sim/signals/fdm-initialized", func { writeSettings(); if (getprop("/options/system/save-state") == 1) { - save.restore(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml"); + save.restore(save.default, pts.Sim.fgHome.getValue() ~ "/Export/" ~ pts.Sim.aircraft.getValue() ~ "-save.xml"); } if (getprop("/options/system/fo-view") == 1) { @@ -169,7 +169,7 @@ setlistener("/sim/signals/fdm-initialized", func { }); setlistener("/sim/signals/exit", func { - save.save(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml"); + save.save(save.default, pts.Sim.fgHome.getValue() ~ "/Export/" ~ pts.Sim.aircraft.getValue() ~ "-save.xml"); }); var renderingSettings = { @@ -202,7 +202,7 @@ var renderingSettings = { }; var readSettings = func { - io.read_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options"); + io.read_properties(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-config.xml", "/systems/acconfig/options"); setprop("/options/system/keyboard-mode", getprop("/systems/acconfig/options/keyboard-mode")); setprop("/options/system/weight-kgs", getprop("/systems/acconfig/options/weight-kgs")); setprop("/options/system/save-state", getprop("/systems/acconfig/options/save-state")); @@ -228,7 +228,7 @@ var writeSettings = func { setprop("/systems/acconfig/options/simbrief-username", getprop("/FMGC/simbrief-username")); setprop("/systems/acconfig/options/atis-server", getprop("/systems/atsu/atis-server")); setprop("/systems/acconfig/options/wxr-server", getprop("/systems/atsu/wxr-server")); - io.write_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options"); + io.write_properties(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-config.xml", "/systems/acconfig/options"); } ################ diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 9c4b7d21..8fa4136f 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -13,11 +13,11 @@ var SimbriefParser = { fetch: func(username, i) { me.inhibit = 1; var stamp = systime(); - http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml") + http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, pts.Sim.fgHome.getValue() ~ "/Export/A320-family-simbrief.xml") .fail(func { me.failure(i) }) .done(func { var errs = []; - call(me.read, [(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs); + call(me.read, [(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs); if (size(errs) > 0) { debug.printerror(errs); me.failure(i); diff --git a/Nasal/FMGC/flightplan-waypoints.nas b/Nasal/FMGC/flightplan-waypoints.nas index a7808639..24319dc0 100644 --- a/Nasal/FMGC/flightplan-waypoints.nas +++ b/Nasal/FMGC/flightplan-waypoints.nas @@ -160,7 +160,7 @@ var WaypointDatabase = { }, # write - write to file, as a hash structure write: func() { - var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml"; + var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWaypoints.xml"; var tree = { waypoints: { @@ -177,7 +177,7 @@ var WaypointDatabase = { }, # read - read from a file, extract using props interface read: func() { - var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml"; + var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWaypoints.xml"; # create file if it doesn't exist if (io.stat(path) == nil) { me.write(); diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 0d28fdd9..c5a5de18 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -226,7 +226,7 @@ var windController = { }, # read - read from hist wind file, create one if it doesn't exist read: func() { - var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt"; + var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWinds.txt"; # create file if it doesn't exist if (io.stat(path) == nil) { me.write(); @@ -267,7 +267,7 @@ var windController = { # write - write to hist wind file, called whenever winds changed write: func() { if (me.des_winds[2] != 0) { - var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt"; + var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWinds.txt"; var file = io.open(path, "wb"); var winds_added = 0; diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index cb5d1857..f290d131 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -217,6 +217,7 @@ var Position = { var Sim = { aero: props.globals.getNode("/sim/aero"), + aircraft: props.globals.getNode("/sim/aircraft"), CurrentView: { fieldOfView: props.globals.getNode("/sim/current-view/field-of-view", 1), headingOffsetDeg: props.globals.getNode("/sim/current-view/heading-offset-deg", 1), @@ -232,6 +233,7 @@ var Sim = { zOffsetMaxM: props.globals.getNode("/sim/current-view/z-offset-max-m", 1), zOffsetMinM: props.globals.getNode("/sim/current-view/z-offset-min-m", 1), }, + fgHome: props.globals.getNode("/sim/fg-home"), Input: { Selected: { engine: [props.globals.getNode("/sim/input/selected/engine[0]", 1),props.globals.getNode("/sim/input/selected/engine[1]", 1)],