Board index FlightGear Development Nasal

How to remove a xml file ?

Nasal is the scripting language of FlightGear.

How to remove a xml file ?

Postby clm76 » Sun Nov 19, 2017 8:54 am

Hi,
Is there a way to remove a xml file stored on the disk ?
For example, I would like to have the possibility from the CDU to remove the flightplan EIDW-LPPR01.xml stored in "fg-home/aircraft-data/FlightPlans/".
clm76
 
Posts: 142
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: How to remove a xml file ?

Postby Hooray » Sun Nov 19, 2017 9:05 am

That would be a potential security issue - even if deleting files/folders were to be constrained to $FG_HOME, aircraft-specific Nasal scripts could still mess up all sorts of important settings in $FG_HOME.
Speaking in general, it is a flawed design to individually save things that you may need to manage/update or delete later on - it would be MUCH cleaner to have a common "MyFlightPlans.xml" file and then explicitly delete any entries there - that is also dead-easy to do using the helpers available in io.nas and props.nas
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: How to remove a xml file ?

Postby clm76 » Sun Nov 19, 2017 4:36 pm

Thanks for your reply,
That would be a potential security issue

I suspected it !...

it would be MUCH cleaner to have a common "MyFlightPlans.xml"

Yes, it's a solution, but with 10, 20, 30 ... flight plans, "MyFlightPlans.xml" may be very big and no so easy to read.
clm76
 
Posts: 142
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: How to remove a xml file ?

Postby Hooray » Sun Nov 19, 2017 4:59 pm

If this is about some kind VA/Virtual Airline thing, another possibility would be to maintain an online flightplan database and use FlightGear's http bindings to fetch flight plans - analogous to how scenery/aircraft and navdata can be downloaded on demand. Obviously, that would require a little server-side script (e.g. php/python) - but otherwise, it'd be fairly straightforward to come up with a web service for managing VA flight plans in a central fashion. As a matter of fact, it would even be possible to host up-to-date navaid information that way, while ensuring that all VA pilots are using the same navdata.

I once documented the underlying idea in the wiki, which includes sample python snippets to implement the server-side to fetch data and load it into FlightGear:

http://wiki.flightgear.org/Howto:Making ... from_Nasal
Image

These days, there are much better methods available - but the general idea is the same, and would be fairly simple to prototype, and even to extend to provide a holistic navigation data web service, which could include all sorts of VA stuff - it's a recurring idea actually: http://wiki.flightgear.org/A_NavDB_Web_Service

And it is also something that could be implemented on top of Richard's Emesary framework: http://wiki.flightgear.org/Emesary
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: How to remove a xml file ?

Postby clm76 » Mon Nov 20, 2017 7:27 am

Thanks for your reply Hooray, I will study that.
clm76
 
Posts: 142
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3


Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest