FlightGear configuration via XML: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{stub}}
{{stub}}


[[File:Fghome-3.7.png|300px|right|Screen shot showing typical structure [[$FG_HOME]]]]


{{PropertyTree}}


Next to using graphical launchers like [[Fgrun]] or [[fgx]] or parsing console commands to FlightGear's binary, FlightGear's configuration can also be set by means of two .xml files.
You can set up a '''FlightGear configuration via XML''' by creating a XML file that loads on to of FlightGear's other settings.


Next to using graphical launchers like [[FGRun]] or [[FGx]] or parsing console commands to FlightGear's binary, FlightGear's configuration can also be set by means of two .xml files.


= Preferences.xml =
== defaults.xml and autosave.xml ==
FlightGear installs with a configuration already set up in a XML file, {{Base Package Resource|filename=preferences.xml}}.  Some of these settings are preserved between FlightGear sessions in another file, <code>autosave.xml</code>.  All settings contained in these two files get parsed by FlightGear while it starts up.


This is FlightGear's main configuration file and located within [[$FG_ROOT]]. It contains nearly all options that can be set, enabled or disabled to configure FlightGear to the user's preference. All options contained within this file get parsed to FlightGear's binary file upon its startup.
Some of the properties in {{Base Package Resource|filename=preferences.xml}} have an XML attribute, <code>userarchive</code>, that automatically add any changes of those properties to <code>autosave.xml</code>.


By using Preferences.xml to configure FlightGear, running a launcher is not necessary to start the simulator. Just start the binary/executable (FGFS) and fly away.
we should absolutely stop telling anyone to edit {{Base Package Resource|filename=preferences.xml}} in FG_ROOT; any documentation or advice which says to should be changes ASAP. <ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=192632#p192632
  |title  =  <nowiki> Re: NavCache:init failed:Sqlite error:Sqlite API abuse </nowiki>
  |author =  <nowiki> zakalawe </nowiki>
  |date  =  Oct 26th, 2013
  |added  =  Oct 26th, 2013
  |script_version = 0.40
  }}</ref>


'''Since the Preferences.xml is considered a FlightGear core file, it is strongly advised to back it up before doing any initial editing. It is also most likely to be overwritten when FlightGear is updated. Uninstalling FlightGear will also delete this file!'''


=== defaults.xml ===
{{Main article|defaults.xml}}
{{Base Package Resource|filename=preferences.xml}} is FlightGear's main configuration file and is located within [[$FG_ROOT]].


= Autosave.xml =
Using the [[PropertyList XML files|property-list]] format it sets up a large number of [[Property tree|properties]] and their values that determines various settings of FlightGear.  It more or less contain all settings that can be set.  All settings contained within this file get parsed by FlightGear while it starts up.


Autosave.xml is a child of Preferences.xml in user space. Location depends on the operating system used.
=== autosave.xml ===
<code>autosave.xml</code> is a child of <code>preferences.xml</code> in user space that contains the properties with an <code>userarchive="y"</code> attribute. Location depends on the operating system used:


* '''Windows Vista/7/8''': C:\Users\{Your username}\AppData\Roaming\flightgear.org\
{| class="wikitable"
* '''Windows XP''': C:\Documents and Settings\{Your username}\Application Data\flightgear.org\
! OS !! Path
* '''Linux/OS X''': ~/.fgfs
|-
| Windows Vista/7/8
| <code>C:\Users\{Your username}\AppData\Roaming\flightgear.org\</code>
|-
| Windows XP
| <code>C:\Documents and Settings\{Your username}\Application Data\flightgear.org\</code>
|-
| Linux/OS X
| <code>~/.fgfs</code>
|}


If not present, it is generated upon launching FGFS with the options set in its parent file Preferences.xml.
If not present, it is generated upon launching FGFS with the options set in its parent file Preferences.xml.
Any changes you do within FlightGear's user interface are saved into autosave.xml, so a manual edit is, in most cases, not necessary.
The next time you launch FGFS, the settings stored in autosave.xml will be used.


[[Category:Discusses editing of preferences.xml]]
Any changes you do within FlightGear's user interface are saved into <code>autosave.xml</code>, so a manual edit is, in most cases, not necessary.  The next time you launch FGFS, the settings stored in <code>autosave.xml</code> will be used.
 
== Adding your own settings ==
Rather than modifying <code>preferences.xml</code> or <code>autosave.xml</code> you should create your own configuration file using the same format and load it using the <code>--config</code> command-line parameter.  You are not limited only to use properties from those files, but can use any properties from the property tree.  You can also add entirely new properties if that is needed.
 
When you use the <code>--config</code> option to load your own configuration, it will be loaded into FlightGear just as <code>preferences.xml</code> and <code>autosave.xml</code>, but your configuration will be used instead.  To use your own configuration add this command-line parameter either in <code>.fgfsrc</code> or when you start FlightGear:
 
--config=/home/<user name>/.fgfs/<my-preferences>.xml
 
The reason to why you should not modify <code>preferences.xml</code> or <code>autosave.xml</code> is that the modifications can cause problems with your FlightGear installation and, unless you manually make a copy of them, they will be lost when you upgrade or uninstall FlightGear.  In addition, using a configuration file from one version of FlightGear with another version may not work too well either.
 
== Related content ==
* [[Properties persistent between sessions]]
* [[PropertyList XML files]]
* [[Property tree]]
 
{{Appendix}}
 
[[Category:FlightGear|Configuration via XML]]
[[Category:XML|Configuration via XML]]
[[Category:Discusses editing preferences.xml]]

Revision as of 22:21, 6 January 2019

This article is a stub. You can help the wiki by expanding it.
Screen shot showing typical structure $FG_HOME

You can set up a FlightGear configuration via XML by creating a XML file that loads on to of FlightGear's other settings.

Next to using graphical launchers like FGRun or FGx or parsing console commands to FlightGear's binary, FlightGear's configuration can also be set by means of two .xml files.

defaults.xml and autosave.xml

FlightGear installs with a configuration already set up in a XML file, defaults.xml (previously, preferences.xml FlightGear commit 78498c560d30797ee55c277ea5f1c74f120fe1a2 ). Some of these settings are preserved between FlightGear sessions in another file, autosave.xml. All settings contained in these two files get parsed by FlightGear while it starts up.

Some of the properties in defaults.xml (previously, preferences.xml FlightGear commit 78498c560d30797ee55c277ea5f1c74f120fe1a2 ) have an XML attribute, userarchive, that automatically add any changes of those properties to autosave.xml.

we should absolutely stop telling anyone to edit defaults.xml (previously, preferences.xml FlightGear commit 78498c560d30797ee55c277ea5f1c74f120fe1a2 ) in FG_ROOT; any documentation or advice which says to should be changes ASAP. [1]


defaults.xml

1rightarrow.png See defaults.xml for the main article about this subject.

defaults.xml (previously, preferences.xml FlightGear commit 78498c560d30797ee55c277ea5f1c74f120fe1a2 ) is FlightGear's main configuration file and is located within $FG_ROOT.

Using the property-list format it sets up a large number of properties and their values that determines various settings of FlightGear. It more or less contain all settings that can be set. All settings contained within this file get parsed by FlightGear while it starts up.

autosave.xml

autosave.xml is a child of preferences.xml in user space that contains the properties with an userarchive="y" attribute. Location depends on the operating system used:

OS Path
Windows Vista/7/8 C:\Users\{Your username}\AppData\Roaming\flightgear.org\
Windows XP C:\Documents and Settings\{Your username}\Application Data\flightgear.org\
Linux/OS X ~/.fgfs

If not present, it is generated upon launching FGFS with the options set in its parent file Preferences.xml.

Any changes you do within FlightGear's user interface are saved into autosave.xml, so a manual edit is, in most cases, not necessary. The next time you launch FGFS, the settings stored in autosave.xml will be used.

Adding your own settings

Rather than modifying preferences.xml or autosave.xml you should create your own configuration file using the same format and load it using the --config command-line parameter. You are not limited only to use properties from those files, but can use any properties from the property tree. You can also add entirely new properties if that is needed.

When you use the --config option to load your own configuration, it will be loaded into FlightGear just as preferences.xml and autosave.xml, but your configuration will be used instead. To use your own configuration add this command-line parameter either in .fgfsrc or when you start FlightGear:

--config=/home/<user name>/.fgfs/<my-preferences>.xml

The reason to why you should not modify preferences.xml or autosave.xml is that the modifications can cause problems with your FlightGear installation and, unless you manually make a copy of them, they will be lost when you upgrade or uninstall FlightGear. In addition, using a configuration file from one version of FlightGear with another version may not work too well either.

Related content

References