<type>documentation</type>
<domain>proj</domain>
<id>variable-expansion</id>
<title>Environment Variable Expansion</title>
<date>$Date: 2009-06-22 17:37:40 -0400 (Mon, 22 Jun 2009) $</date>
<version>$Revision: 20510 $</version>
<product>per+</product>

Any string value for a property may contain environment variable references using the
``$(name)`` or ``$ {name}`` notation. These will be replaced with the value of the
environment variable when used by the IDE. If the environment variable is not set, the
reference will be replaced by an empty string. 

The system environment, as modified by Wing's `Project Properties
<ref:proj/project-properties>`__ and `File Properties
<ref:proj/file-properties>`__, is used to expand variable references.

**Special Environment Variables**

The following special variable names are defined by Wing, as a way to insert values that
depend on the currently open project configuration and state of Wing's user interface.

*File at Current Focus*

* ``WING:FILENAME`` -- Full path of the currently selected file at the focus anywhere in the user interface, 
  either in the editor, in the ``Project`` tool, or in other places where files can be selected.
* ``WING:FILENAME_DIR`` -- Full path of the directory containing the file in ``WING:FILENAME``. Note that 
  the full path does not include a trailing slash.
* ``WING:FILENAME_BASE`` -- Base name of the file in ``WING:FILENAME``
* ``WING:LINENO`` -- Current line number in the file ``WING:FILENAME``
* ``WING:SCOPE`` -- Dotted name of the current scope in the file ``WING:FILENAME`` (if Python)

*File in Current Editor*

* ``WING:EDITOR_FILENAME`` -- Full path of the file open in the current editor, even if focus is elsewhere 
  in the user interface.
* ``WING:EDITOR_FILENAME_DIR`` -- Full path of the directory containing the file in ``WING:EDITOR_FILENAME``.
  Note that the full path does not include a trailing slash.
* ``WING:EDITOR_FILENAME_BASE`` -- Base name of the file in ``WING:EDITOR_FILENAME``
* ``WING:EDITOR_LINENO`` -- Current line number in the file ``WING:EDITOR_FILENAME``
* ``WING:EDITOR_SCOPE`` -- Dotted name of the current scope in the file ``WING:EDITOR_FILENAME`` (if Python)
* ``WING:EDITOR_SELECTION`` -- The text selected on the current editor, if any.

*Attributes of the Currently Opened Project*

* ``WING:PROJECT`` Full path of current project, including the ``*.wpr`` project file name.
* ``WING:PROJECT_DIR`` -- Full path of the directory containing the current project's ``*.wpr``. Note that the 
  full path does not include a trailing slash.
* ``WING:PROJECT_HOME`` -- Full path of the ``Project Home`` directory, as set in 
  ``Project Properties``; by default this is the same as ``WING:PROJECT_DIR``. Note that the full path does not 
  include a trailing slash.
* ``WING:PYTHON`` -- The Python interpreter being used in the current project.
~~~if WINGPRO:
* ``WING:HOSTNAME`` -- (Wing Pro only) The remote configuration's ``Hostname`` for the current project, or the empty 
  string if not a remote project.
~~~

*Attributes of the Wing Installation*

* ``WING:INSTALL_DIR`` -- The installation directory of Wing (sometimes referred to as ``WINGHOME``)
* ``WING:SETTINGS_DIR`` -- The user settings directory currently in use by Wing

These can be use the same way as other environment variables, for example
``${WING:FILENAME}``. Values based on the currently selected file or selection will
evaluate to an empty string when there is none.
