$FG AIRCRAFT: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Don't add $FG_ROOT/Aircraft)
(→‎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)
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''$FG_AIRCRAFT''' is refered to as the aircraft directory or directories of [[FlightGear]]. It is available since FlightGear 2.4.0.
<code>'''$FG_AIRCRAFT'''</code> 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]] (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 [[FlightGear Launch Control#Page One - Paths|first page]] of [[FGRun]] (before the default aircraft selection page). <tt>[[$FG_ROOT]]/Aircraft</tt> should never be added to <code>$FG_AIRCRAFT</code>, otherwise aircraft will be listed twice in FGRun.
 
== Aircraft loading algorithm ==
See [http://forum.flightgear.org/viewtopic.php?f=4&t=28444#p271683 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 <code>$FG_AIRCRAFT</code> and <tt>[[$FG_ROOT]]/Aircraft</tt>, as well as in the arguments of <tt>--fg-aircraft</tt> options (for the fgfs command line).
 
== Relation between <tt>FG_AIRCRAFT</tt>/<tt>--fg-aircraft</tt> and <tt>--aircraft-dir</tt> ==
The <tt>fgfs</tt> <tt>--fg-aircraft</tt> [[Command_line_options|command line option]] and the <tt>FG_AIRCRAFT</tt> environment variable have the same purpose: each of them can specify a list of one or more aircraft directories, separated with a semicolon (<tt>;</tt>) on Windows, and a colon (<tt>:</tt>) on other operating systems. Each directory of the list in question should contain directories that themselves contain aircraft <tt>-set.xml</tt> files (i.e., each component of <tt>FG_AIRCRAFT</tt> or <tt>--fg-aircraft</tt> can list many different aircrafts, not only variants of the same aircraft).
 
Typically, directories listed in <tt>FG_AIRCRAFT</tt> or in the value for <tt>--fg-aircraft</tt> options are called <tt>Aircraft</tt>. Prime examples are the <tt>Aircraft</tt> top-level directories of [[$FG_ROOT]] and [[FGAddon]]. They will themselves contain subdirectories named for instance <tt>c172p</tt>, <tt>ufo</tt>, <tt>707</tt>, etc.
 
The differences between <tt>FG_AIRCRAFT</tt> and <tt>--fg-aircraft</tt> are:
* <tt>FG_AIRCRAFT</tt> is an environment variable, and as such cannot be specified several times like a command-line option (the variable may be <i>set</i> or <i>unset</i> in FlightGear's environment, that's all). By the way, customarily, <tt><code>$FG_AIRCRAFT</code></tt> refers to the <em>value</em> of the <tt>FG_AIRCRAFT</tt> environment variable (this is the POSIX shell syntax used to expand an environment variable).
* <tt>--fg-aircraft</tt> is an <tt>fgfs</tt> [[Command_line_options|command line option]]. It may be passed several times on the same <tt>fgfs</tt> command line, and the directories listed therein have higher precedence than those listed in <tt>FG_AIRCRAFT</tt> (from a code inspection of FlightGear's development version from January 2016).
 
In contrast, <tt>--aircraft-dir</tt>, if specified, takes a single path as its argument. This should be a path to a directory (such as <tt>c172p</tt> or <tt>707</tt>) directly containing one or more aircraft <tt>-set.xml</tt> files. Thus, <tt>--aircraft-dir</tt> (when specified) should point to directories located <em>within</em> the directories listed via <tt>FG_AIRCRAFT</tt>, <tt>--fg-aircraft</tt>, or <tt>[[$FG_ROOT]]/Aircraft</tt>.
 
For example, one can run:
<syntaxhighlight lang="bash">
fgfs --fg-aircraft=/path/to/Aircraft --fg-aircraft=/other/path/to/Aircraft --aircraft=707
</syntaxhighlight>
 
where <tt>/path/to/Aircraft</tt> could contain subdirectories named <tt>c172p</tt> and <tt>707</tt>, and for instance <tt>/other/path/to/Aircraft</tt> could contain subdirectories named <tt>CRJ700-family</tt> and <tt>ZLT-NT</tt>. On the other hand, using <tt>--aircraft-dir</tt> would be more like this:
<syntaxhighlight lang="bash">
fgfs --fg-aircraft=/path/to/fgaddon/Aircraft --aircraft-dir=/path/to/fgaddon/Aircraft/ec130 --aircraft=ec130b4 ...
</syntaxhighlight>
 
(It seems to work without the <tt>--fg-aircraft=/path/to/fgaddon/Aircraft</tt>, but I prefer to pass it in order to prevent potential permission issues). In this case, FlightGear would expect <tt>/path/to/fgaddon/Aircraft/ec130</tt> to be a directory containing an <tt>ec130b4-set.xml</tt> file.
 
{{Note|<syntaxhighlight lang="bash">
fgfs --fg-aircraft=/path/to/Aircraft --fg-aircraft=/other/path/to/Aircraft
</syntaxhighlight>
 
is equivalent to the following command on Linux and on OS X:
 
<syntaxhighlight lang="bash">
fgfs --fg-aircraft=/path/to/Aircraft:/other/path/to/Aircraft
</syntaxhighlight>
 
On Windows, one would rather use something like this:
 
<syntaxhighlight lang="powershell">
fgfs --fg-aircraft=C:\path\to\Aircraft;C:\other\path\to\Aircraft
</syntaxhighlight>
 
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, <tt>--aircraft-dir</tt> bypasses the order defined by <tt>--fg-aircraft</tt>, <tt>FG_AIRCRAFT</tt> and <tt>[[$FG_ROOT]]/Aircraft</tt>. 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 &lt;path-cache&gt; in <tt>[[$FG_HOME]]/autosave_X_Y.xml</tt> is empty; “cached” entries have a higher priority than entries searched in directories from <tt>--fg-aircraft</tt>, <tt><code>$FG_AIRCRAFT</code></tt> and <tt>[[$FG_ROOT]]/Aircraft</tt>, but <tt>--aircraft-dir</tt> always “wins” if specified, even in the presence of cached entries).


[[Category:Special directories|AIRCRAFT]]
[[Category:Special directories|AIRCRAFT]]
[[fr:$FG AIRCRAFT]]
[[fr:$FG AIRCRAFT]]

Revision as of 11:10, 24 March 2016

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