|
From: merspieler <mer...@al...> - 2023-06-06 11:37:37
|
So I don't even need to do that as the overlay selector already has
resolvepath?
Our current state of the code was this:
var m = { parents: [canvas_livery, gui.OverlaySelector.new("Select Livery", [dir, getprop("/sim/fg-home") ~ "/Export/Liveries/" ~ getprop("/sim/aircraft-id")], nameprop, sortprop, "sim/model/livery/file")] };
If I say, I also want Liveries/<aircraft-id> to be included in the
search (and added a matching directory) like this:
var m = { parents: [canvas_livery, gui.OverlaySelector.new("Select Livery", [dir, getprop("/sim/fg-home") ~ "/Export/Liveries/" ~ getprop("/sim/aircraft-id"), "Liveries/" ~ getprop("/sim/aircraft-id")], nameprop, sortprop, "sim/model/livery/file")] };
I get this error upon starting the sim, breaking the aircraft:
38.07 [ALRT]:nasal directory(): listing '/games/flightgear/flightgear-nix-working/install/flightgear/bin' denied (unauthorized directory - authorization no longer follows symlinks; to authorize reading additional directories, pass them to --allow-nasal-read)
38.07 [ALRT]:nasal Nasal runtime error: object has no size()
38.07 [ALRT]:nasal at /games/flightgear/fgdata/Nasal/gui.nas, line 388
38.07 [ALRT]:nasal called from: /games/flightgear/fgdata/Nasal/gui.nas, line 371
38.07 [ALRT]:nasal called from: /games/flightgear/fgdata/Nasal/gui.nas, line 361
38.07 [ALRT]:nasal called from: /games/.fgfs/Aircraft/A320-family/Nasal/Libraries/canvasLiv.nas, line 71
38.07 [ALRT]:nasal called from: /games/.fgfs/Aircraft/A320-family/Nasal/Libraries/libraries.nas, line 36
Yes, we've got symlinks in our stuff, but not to that Livery dir.
(Unless you account for the fact that ~/.fgfs is symlinked but that
has never been an issue anywhere else)
On Tue Jun 6, 2023 at 12:57 PM CEST, James Turner wrote:
>
>
> > On 5 Jun 2023, at 17:01, mer...@al... wrote:
> >
> > As for the original question, we'd then just take the Aircraft dirs... where in the prop tree can we find them?
>
> You wan to use the Nasal resolvepath() function, again like the GUi
> selector we don’t want people doing manual path handling in Nasal
> because it often gets weird with non-Latin paths.
>
> resolvepath() takes a path ‘tail’ and tries it against each
> aircraft/data path in turn until it finds a match, then gives back the
> resolved absolute path to what it found.
>
> eg resolvepath(“Liveries/c172p/livery-foobar.xml”)
>
> .. might give you back
>
> C://Users/jimbob/Some/Dirs/My-Aircraft/Liveries/c172p/livery-foobar.xml
> <c://Users/jimbob/Some/Dirs/My-Aircraft/Liveries/c172p/livery-foobar.xml>
>
>
> Kind regards,
> James
|