Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

$FG AIRCRAFT

From FlightGear wiki
Revision as of 06:10, 24 March 2016 by Rominet (Talk | contribs) (Relation between FG_AIRCRAFT/--fg-aircraft and --aircraft-dir: Improve readability and accuracy ("equivalent" has a strong meaning for me) in the Note concerning --fg-aircraft)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

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

is equivalent to the following command on Linux and on OS X:

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

On Windows, one would rather use something like this:

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

The differences are that:

  • Windows uses a semicolon instead of a colon to separate the paths;
  • the paths use backslashes instead of forward slashes, 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).