Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ExecutionEnvironment Class Reference

Encapsulates access to the environment variables and command-line arguments at the time of execution. More...

Public Member Functions

 __init__ (const ExecutionEnvironment)
 

Static Public Member Functions

static clearShadow (str var)
 Removes a value set by a previous call to shadow_environment_variable(), and lets the actual value of the variable show again. More...
 
static str expandString (str str)
 Reads the string, looking for environment variable names marked by a $. More...
 
static str getArg (int n)
 Returns the nth command-line argument. More...
 
static str getBinaryName ()
 Returns the name of the binary executable that started this program, if it can be determined. More...
 
static Filename getCwd ()
 Returns the name of the current working directory. More...
 
static str getDtoolName ()
 Returns the name of the libdtool DLL that is used in this program, if it can be determined. More...
 
static str getEnvironmentVariable (str var)
 Returns the definition of the indicated environment variable, or the empty string if the variable is undefined. More...
 
static int getNumArgs ()
 Returns the number of command-line arguments available, not counting arg 0, the binary name. More...
 
static bool hasEnvironmentVariable (str var)
 Returns true if the indicated environment variable is defined. More...
 
static setBinaryName (str name)
 Do not use. More...
 
static setDtoolName (str name)
 Do not use. More...
 
static setEnvironmentVariable (str var, str value)
 Changes the definition of the indicated environment variable. More...
 
static shadowEnvironmentVariable (str var, str value)
 Changes the apparent definition of the indicated environment variable by masking it within this class with a new value. More...
 

Public Attributes

String args []
 
String binary_name
 Returns the name of the binary executable that started this program, if it can be determined. More...
 
Filename cwd
 Returns the name of the current working directory. More...
 
String dtool_name
 Returns the name of the libdtool DLL that is used in this program, if it can be determined. More...
 
String environment_variables []
 

Detailed Description

Encapsulates access to the environment variables and command-line arguments at the time of execution.

This is encapsulated to support accessing these things during static init time, which seems to be risky at best.

Member Function Documentation

◆ __init__()

__init__ ( const  ExecutionEnvironment)

◆ clearShadow()

static clearShadow ( str  var)
static

Removes a value set by a previous call to shadow_environment_variable(), and lets the actual value of the variable show again.

◆ expandString()

static str expandString ( str  str)
static

Reads the string, looking for environment variable names marked by a $.

Expands all such variable names. A repeated dollar sign ($$) is mapped to a single dollar sign.

Returns the expanded string.

◆ getArg()

static str getArg ( int  n)
static

Returns the nth command-line argument.

The index n must be in the range [0 .. get_num_args()). The first parameter, n == 0, is the first actual parameter, not the binary name.

◆ getBinaryName()

static str getBinaryName ( )
static

Returns the name of the binary executable that started this program, if it can be determined.

◆ getCwd()

static Filename getCwd ( )
static

Returns the name of the current working directory.

◆ getDtoolName()

static str getDtoolName ( )
static

Returns the name of the libdtool DLL that is used in this program, if it can be determined.

◆ getEnvironmentVariable()

static str getEnvironmentVariable ( str  var)
static

Returns the definition of the indicated environment variable, or the empty string if the variable is undefined.

◆ getNumArgs()

static int getNumArgs ( )
static

Returns the number of command-line arguments available, not counting arg 0, the binary name.

◆ hasEnvironmentVariable()

static bool hasEnvironmentVariable ( str  var)
static

Returns true if the indicated environment variable is defined.

◆ setBinaryName()

static setBinaryName ( str  name)
static

Do not use.

◆ setDtoolName()

static setDtoolName ( str  name)
static

Do not use.

◆ setEnvironmentVariable()

static setEnvironmentVariable ( str  var,
str  value 
)
static

Changes the definition of the indicated environment variable.

◆ shadowEnvironmentVariable()

static shadowEnvironmentVariable ( str  var,
str  value 
)
static

Changes the apparent definition of the indicated environment variable by masking it within this class with a new value.

This does not change the actual environment variable, but future calls to get_environment_variable() will return this new value.

Member Data Documentation

◆ args

String args[]

◆ binary_name

String binary_name

Returns the name of the binary executable that started this program, if it can be determined.

◆ cwd

Filename cwd

Returns the name of the current working directory.

◆ dtool_name

String dtool_name

Returns the name of the libdtool DLL that is used in this program, if it can be determined.

◆ environment_variables

String environment_variables[]