Environment variables

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.

Environment variables This is a link to a Wikipedia article are a way of defining settings that can be used by applications like FlightGear. Environment variables are set by using the operating system interfaces.

Note: Most (all?) settings used by FlightGear can be set without using environment variables - for example configuring settings from the Qt launcher, the GUI inside the simulator, or the command-line. However, parts of FlightGear like 3rd party opensource libraries such as OSG, or parts like SimGear, may have advanced or experimental settings that can only be set using environment variables - these types of settings are only useful for power users and developers.

Setting environment variables from your Operating System

Linux

The most common way to define environment variables in a UNIX / Linux system is to include them into environment files.

You can do that :

  • at system level (for all users on the system) : define your FlightGear environment variables in /etc/environment file (add one line for each variable).
  • at user level : on your home directory ($HOME) exists a user profile file, according to your login shell. For example, if you are using BASH, a file named .bashrc contains your user-defined environment. Define your FlightGear environment variables into this file (add one line for each variable).
FG_ROOT=/usr/games/flightgear

FG_AIRCRAFT=/usr/games/flightgear/aircraft

FG_SCENERY=/usr/games/flightgear/scenery

export FG_ROOT FG_AIRCRAFT FG_SCENERY

Windows

Windows 10 dialog boxes for creating a new 'User environment variable', and setting the name and value of that environment variable
Windows 10 dialog boxes for creating a new 'User environment variable', and setting the name and value of that environment variable. The environment variable that is being defined is $FG ROOT, a directory where FlightGear data of the base package is stored. The value in this case is the path to the directory. Note that most (all?) FlightGear environment variables can be set without using the operating system interfaces. Click to enlarge.

Windows allows you to set environment variables from a graphical user interface (GUI) dialog box or the command-prompt.

GUI

User environment variables (docs - archive Feb 2020) are only visible to programs run by the current user, you should probably just define the environment variables for FlightGear settings here.

Open the Advanced System settings dialog box:

  • Right click on My Computer on the desktop > click Properties > click Advanced System Settings link
  • Control Panel > System > click Advanced System Settings link

Add a new environment variable for a FlightGear setting, and assign a value to it

  • Click environment variables > User variables for [your account name here] > click New
  • Enter the name of the Environment variable, Enter the value of the environment variable

Command-prompt

Open command-prompt. Type setand press Enter to show all defined environment variables. Type set [variable_name for the setting]=[value to set]to define an environment variable and set it to a value.

MacOS

Environment variable settings