Board index FlightGear Development Nasal

NASAL code to get list of files in a directory  Topic is solved

Nasal is the scripting language of FlightGear.

NASAL code to get list of files in a directory

Postby leechpool » Tue Sep 03, 2019 2:57 pm

Hi,
Is it possible to get a list of files in a directory within nasal, e.g. the files in $FG_HOME/Input/Joystick/ ?
Sorry if this should be obvious but I've been searching for a while and can't get anywhere.
I'm relatively new to nasal / xml joystick files.
Appreciate any help / pointers to where to look.
Thanks
:D
leechpool
 
Posts: 8
Joined: Thu Aug 01, 2019 8:17 am

Re: NASAL code to get list of files in a directory

Postby Necolatis » Tue Sep 03, 2019 11:24 pm

"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1943
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: NASAL code to get list of files in a directory

Postby Thorsten » Wed Sep 04, 2019 5:10 am

Nasal file I/O is intentionally pretty restricted to prevent malicious 3rd party aircraft from making free with your computer.

Say you install this cool aircraft, and that makes a list of all files with 'password' in them in your homedirectory and sends them to me when you install it - not cool in the end!
Thorsten
 
Posts: 10982
Joined: Mon Nov 02, 2009 8:33 am

Re: NASAL code to get list of files in a directory  

Postby Hooray » Wed Sep 04, 2019 5:24 pm

While the previously mentioned I/O restrictions do still apply, there is a corresponding API available and it's also commonly/widely used for exactly the purposes that the OP mentioned: http://wiki.flightgear.org/Nasal_librar ... tory.28.29
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: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: NASAL code to get list of files in a directory

Postby Thorsten » Wed Sep 04, 2019 6:37 pm

Thanks - I actually didn't know that!
Thorsten
 
Posts: 10982
Joined: Mon Nov 02, 2009 8:33 am

Re: NASAL code to get list of files in a directory

Postby leechpool » Thu Sep 05, 2019 11:18 pm

All,
Thanks. Looks like exactly what I was looking for.
:)
leechpool
 
Posts: 8
Joined: Thu Aug 01, 2019 8:17 am


Return to Nasal

Who is online

Users browsing this forum: No registered users and 4 guests