$FG AIRCRAFT: Difference between revisions

Jump to navigation Jump to search
183 bytes removed ,  23 March 2016
Bit of cleanup
m ("aircraft" is always singular (don't worry, English can be terribly complicated if it's not your native language ;) ))
(Bit of cleanup)
Line 1: Line 1:
{{-}}
<code>'''$FG_AIRCRAFT'''</code> is referred to as the aircraft directory or directories of [[FlightGear]]. It is available since FlightGear 2.4.


'''$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 [[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.


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.
== 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).
== How does FlightGear find the aircraft to load? ==
 
See [http://forum.flightgear.org/viewtopic.php?f=4&t=28444&p=271683#p271683 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 <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> ==
== 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).


<ul>
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.
  <li>
    <p>
      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).
    </p>
 
    <p>
      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.
    </p>


    <p>
The differences between <tt>FG_AIRCRAFT</tt> and <tt>--fg-aircraft</tt> are:
      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).
    </p>
* <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).


    <ul>
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>.
      <li>
        <p>
          <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>$FG_AIRCRAFT</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).
        </p>
      </li>
      <li>
        <p>
          <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).
        </p>
      </li>
    </ul>
  </li>
  <li>
    <p>
      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>.
    </p>
  </li>
</ul>


For example, one can run:
For example, one can run:
 
<syntaxhighlight lang="bash">
<syntaxhighlight lang="shell" enclose="div">
fgfs --fg-aircraft=/path/to/Aircraft --fg-aircraft=/other/path/to/Aircraft --aircraft=707
fgfs --fg-aircraft=/path/to/Aircraft \
    --fg-aircraft=/other/path/to/Aircraft \
    --aircraft=707 ...
</syntaxhighlight>
</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:
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">
<syntaxhighlight lang="shell" enclose="div">
fgfs --fg-aircraft=/path/to/fgaddon/Aircraft --aircraft-dir=/path/to/fgaddon/Aircraft/ec130 --aircraft=ec130b4 ...
fgfs --fg-aircraft=/path/to/fgaddon/Aircraft \
    --aircraft-dir=/path/to/fgaddon/Aircraft/ec130 \
    --aircraft=ec130b4 ...
</syntaxhighlight>
</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.
(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|<pre>--fg-aircraft=/path/to/Aircraft --fg-aircraft=/other/path/to/Aircraft</pre>
{{Note|<syntaxhighlight lang="bash">
fgfs --fg-aircraft=/path/to/Aircraft --fg-aircraft=/other/path/to/Aircraft
</syntaxhighlight>


is equivalent to:
is equivalent to:


<pre>--fg-aircraft=/path/to/Aircraft:/other/path/to/Aircraft</pre>
<syntaxhighlight lang="bash">
fgfs --fg-aircraft=/path/to/Aircraft:/other/path/to/Aircraft
</syntaxhighlight>


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


<pre>--fg-aircraft=/path/to/Aircraft;/other/path/to/Aircraft</pre>
<syntaxhighlight lang="powershell">
fgfs --fg-aircraft=C:\path\to\Aircraft;C:\other\path\to\Aircraft
</syntaxhighlight>


instead (colon versus semicolon). And of course, on Windows you would use paths starting with a device letter and containing backslashes, such as <tt>C:\FlightGear\MyAircraftCollection</tt>, or whatever.}}
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, <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>$FG_AIRCRAFT</tt> and <tt>[[$FG_ROOT]]/Aircraft</tt>, but <tt>--aircraft-dir</tt> always “wins” if specified, even in the presence of cached entries).
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]]

Navigation menu