From FlightGear wiki
Revision as of 13:08, 23 March 2016 by Red Leader (Talk | contribs) (Bit of cleanup)

Jump to: navigation, search

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

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

Aircraft loading algorithm

See this forum post for a description of the algorithm used by FlightGear (as of the 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.

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

is equivalent to:

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

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

fgfs --fg-aircraft=C:\path\to\Aircraft;C:\other\path\to\Aircraft

The difference is that Windows uses a semicolon instead colon to separate the path, the paths use backslashes, and a drive letter is given.

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).