$FG AIRCRAFT: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Add explanation concerning --fg-aircraft, $FG_AIRCRAFT and --aircraft-dir, as suggested by http://forum.flightgear.org/viewtopic.php?f=22&t=29061&p=279513#p279513)
m (Add missing plural "s")
Line 3: Line 3:
'''$FG_AIRCRAFT''' is refered to as the aircraft directory or directories of [[FlightGear]]. It is available since FlightGear 2.4.0.
'''$FG_AIRCRAFT''' is refered to as the aircraft directory or directories of [[FlightGear]]. It is available since FlightGear 2.4.0.


It can be set on the first page of [[FGRun]] (previous from aircraft selection). <tt>[[$FG_ROOT]]/Aircraft</tt> should never be added to $FG_AIRCRAFT, else aircraft will be listed twice in FGRun.
It can be set on the first page of [[FGRun]] (previous from aircraft selection). <tt>[[$FG_ROOT]]/Aircraft</tt> should never be added to $FG_AIRCRAFT, else aircrafts will be listed twice in FGRun.


== How does FlightGear find the aircraft to load? ==
== How does FlightGear find the aircraft to load? ==

Revision as of 09:25, 16 March 2016


$FG_AIRCRAFT is refered to as the aircraft directory or directories of FlightGear. It is available since FlightGear 2.4.0.

It can be set on the first page of FGRun (previous from aircraft selection). $FG_ROOT/Aircraft should never be added to $FG_AIRCRAFT, else aircrafts will be listed twice in FGRun.

How does FlightGear find the aircraft to load?

See this forum post for a description of the algorithm used by FlightGear (development version of January 2016) to choose between the various directories listed in $FG_AIRCRAFT and $FG_ROOT/Aircraft, as well as in the arguments of --fg-aircraft options (for the fgfs command line).

Relation between FG_AIRCRAFT/--fg-aircraft and --aircraft-dir

  • The fgfs --fg-aircraft command line option and the FG_AIRCRAFT environment variable have the same purpose: each of them can specify a list of one or more aircraft directories, separated with a semicolon (;) on Windows, and a colon (:) on other operating systems. Each directory of the list in question should contain directories that themselves contain aircraft -set.xml files (i.e., each component of FG_AIRCRAFT or --fg-aircraft can list many different aircrafts, not only variants of the same aircraft).

    Typically, directories listed in FG_AIRCRAFT or in the value for --fg-aircraft options are called Aircraft. Prime examples are the Aircraft top-level directories of $FG_ROOT and FGAddon. They will themselves contain subdirectories named for instance c172p, ufo, 707, etc.

    The differences between FG_AIRCRAFT and --fg-aircraft are:

    • FG_AIRCRAFT is an environment variable, and as such cannot be specified several times like a command-line option (the variable may be set or unset in FlightGear's environment, that's all). By the way, customarily, $FG_AIRCRAFT refers to the value of the FG_AIRCRAFT environment variable (this is the POSIX shell syntax used to expand an environment variable).

    • --fg-aircraft is an fgfs command line option. It may be passed several times on the same fgfs command line, and the directories listed therein have higher precedence than those listed in FG_AIRCRAFT (from a code inspection of FlightGear's development version from January 2016).

  • In contrast, --aircraft-dir, if specified, takes a single path as its argument. This should be a path to a directory (such as c172p or 707) directly containing one or more aircraft -set.xml files. Thus, --aircraft-dir (when specified) should point to directories located within the directories listed via FG_AIRCRAFT, --fg-aircraft, or $FG_ROOT/Aircraft.

For example, one can run:

fgfs --fg-aircraft=/path/to/Aircraft \
     --fg-aircraft=/other/path/to/Aircraft \
     --aircraft=707 ...

where /path/to/Aircraft could contain subdirectories named c172p and 707, and for instance /other/path/to/Aircraft could contain subdirectories named CRJ700-family and ZLT-NT. On the other hand, using --aircraft-dir would be more like this:

fgfs --fg-aircraft=/path/to/fgaddon/Aircraft \
     --aircraft-dir=/path/to/fgaddon/Aircraft/ec130 \
     --aircraft=ec130b4 ...

(it seems to work without the --fg-aircraft=/path/to/fgaddon/Aircraft, but I prefer to pass it in order to prevent potential permission issues). In this case, FlightGear would expect /path/to/fgaddon/Aircraft/ec130 to be a directory containing an ec130b4-set.xml file.

Note
--fg-aircraft=/path/to/Aircraft --fg-aircraft=/other/path/to/Aircraft

is equivalent to:

--fg-aircraft=/path/to/Aircraft:/other/path/to/Aircraft

on Linux and OS X, but on Windows, it is equivalent to:

--fg-aircraft=/path/to/Aircraft;/other/path/to/Aircraft

instead (colon versus semicolon). And of course, on Windows you would use paths starting with a device letter and containing backslashes, such as C:\FlightGear\MyAircraftCollection, or whatever.

When specified, --aircraft-dir bypasses the order defined by --fg-aircraft, FG_AIRCRAFT and $FG_ROOT/Aircraft. This allows one to use an aircraft that would otherwise be shadowed by an aircraft with the same name placed earlier in the path list built from these three places (note that said order is only reliable when the <path-cache> in $FG_HOME/autosave_X_Y.xml is empty; “cached” entries have a higher priority than entries searched in directories from --fg-aircraft, $FG_AIRCRAFT and $FG_ROOT/Aircraft, but --aircraft-dir always “wins” if specified, even in the presence of cached entries).