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 3: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: 21
Joined: Thu Aug 01, 2019 9:17 am

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

Postby Necolatis » Wed Sep 04, 2019 12:24 am

"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2233
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

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

Postby Thorsten » Wed Sep 04, 2019 6: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: 12490
Joined: Mon Nov 02, 2009 9:33 am

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

Postby Hooray » Wed Sep 04, 2019 6: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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

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

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

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

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

Postby leechpool » Fri Sep 06, 2019 12:18 am

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


Return to Nasal

Who is online

Users browsing this forum: No registered users and 4 guests