FlightGear configuration via XML: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (cleanup of one part, fix outdated references to preferences.xml)
 
Line 5: Line 5:
{{PropertyTree}}
{{PropertyTree}}


You can set up a '''FlightGear configuration via XML''' by creating a XML file that loads on to of FlightGear's other settings.
You can set up a '''FlightGear configuration via XML''' by creating a XML file that loads on top of FlightGear's other settings XML file, and replaces those setting values with your own preferences. This way, if you make a mistake, run into problems, or just want to restore settings to what they were you can simply remove your changes.


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.
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 ==
== defaults.xml and autosave.xml ==
On startup Flightgear reads both <code>autosave.xml</code> and <code>defaults.xml</code> to find values for all configuration settings. Flightgear then stores these settings in the [[Property_tree|property tree]] after which the parts of Flightgear that need settings will use them. These two files are [[XML|XML text files]] and you can easily read or edit them using a simple text editor.
On startup, Flightgear reads both <code>autosave.xml</code> and <code>defaults.xml</code> to find values for all configuration settings. Flightgear then stores these settings in the [[Property_tree|property tree]] after which the parts of Flightgear that need settings can use them. These two files are [[XML|XML text files]] and you can easily read or edit them using a simple text editor.


* {{Base Package Resource|filename=preferences.xml}} is a XML text file that contains the ''default configuration'' settings. It comes already installed with Flightgear.  
* {{Base Package Resource|filename=preferences.xml}} is a XML text file that contains the ''default configuration'' settings. It comes already installed with Flightgear.  
Line 16: Line 16:


* <code>autosave.xml</code> is a XML text file that contains ''changes'' to ''some'' settings contained in <code>defaults.xml</code>. Changes to these settings are saved between sessions.  
* <code>autosave.xml</code> is a XML text file that contains ''changes'' to ''some'' settings contained in <code>defaults.xml</code>. Changes to these settings are saved between sessions.  
:: <code>autosave.xml</code> should not be edited by users. If you want to set properties at startup a new custom settings XML file should be created instead of editing <code>autosave.xml</code>.
:: <code>autosave.xml</code> should not be normally edited by users. If you want to set properties at startup, a new custom settings XML file should be [[FlightGear_configuration_via_XML#Adding_your_own_settings|created]] and loaded using the <code>--config</code> option, instead of editing <code>autosave.xml</code>.


:: Note only some settings are saved between sessions. Settings which are to be saved have an XML attribute: <code>userarchive</code>. Changes to other settings will not be saved, and Flightgear will start up in the next session with the defaults from <code>defaults.xml</code>.
:: Note: only some settings are saved between sessions. Settings which are to be saved have an XML attribute: <code>userarchive</code>. Changes to other settings will not be saved, and Flightgear will start up in the next session with the defaults from <code>defaults.xml</code>.


:: If you want to restore default settings ('factory defaults') to see if a problem goes away you can delete <code>autosave.xml</code>. You can also back up the file and restore it later. See [[Troubleshooting_problems|troubleshooting]].
:: Tip: If you want to restore default settings ('factory defaults') to see if a problem goes away you can delete <code>autosave.xml</code>. You can also back up the file and restore it later. See [[Troubleshooting_problems|troubleshooting problems]].


{{Note|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 changed ASAP. <ref>{{cite web
{{Note|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 changed ASAP. <ref>{{cite web
Line 29: Line 29:
   |added  =  Oct 26th, 2013  
   |added  =  Oct 26th, 2013  
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>}}
   }}</ref>
}}


=== defaults.xml ===
=== defaults.xml ===
Line 58: Line 59:


== Adding your own settings ==
== 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.
Rather than modifying <code>defaults.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_options|command-line parameter]]. This command-line option can also simply be entered in the [[FlightGear_Qt_launcher|launcher GUI]]. 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:
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:
Line 64: Line 65:
  --config=/home/<user name>/.fgfs/<my-preferences>.xml
  --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.
The reason to why you should not modify <code>defaults.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 ==
== Related content ==

Latest revision as of 10:15, 10 September 2020

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 top of FlightGear's other settings XML file, and replaces those setting values with your own preferences. This way, if you make a mistake, run into problems, or just want to restore settings to what they were you can simply remove your changes.

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

On startup, Flightgear reads both autosave.xml and defaults.xml to find values for all configuration settings. Flightgear then stores these settings in the property tree after which the parts of Flightgear that need settings can use them. These two files are XML text files and you can easily read or edit them using a simple text editor.

defaults.xml should not be changed by users.
  • autosave.xml is a XML text file that contains changes to some settings contained in defaults.xml. Changes to these settings are saved between sessions.
autosave.xml should not be normally edited by users. If you want to set properties at startup, a new custom settings XML file should be created and loaded using the --config option, instead of editing autosave.xml.
Note: only some settings are saved between sessions. Settings which are to be saved have an XML attribute: userarchive. Changes to other settings will not be saved, and Flightgear will start up in the next session with the defaults from defaults.xml.
Tip: If you want to restore default settings ('factory defaults') to see if a problem goes away you can delete autosave.xml. You can also back up the file and restore it later. See troubleshooting problems.
Note  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 changed 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 defaults.xml or autosave.xml you should create your own configuration file using the same format and load it using the --config command-line parameter. This command-line option can also simply be entered in the launcher GUI. 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 defaults.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