Panda3D
|
Encapsulates access to the environment variables and command-line arguments at the time of execution. More...
#include "executionEnvironment.h"
Static Public Member Functions | |
static void | clear_shadow (const string &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 string | expand_string (const string &str) |
Reads the string, looking for environment variable names marked by a $. More... | |
static string | get_arg (int n) |
Returns the nth command-line argument. More... | |
static string | get_binary_name () |
Returns the name of the binary executable that started this program, if it can be determined. More... | |
static Filename | get_cwd () |
Returns the name of the current working directory. More... | |
static string | get_dtool_name () |
Returns the name of the libdtool DLL that is used in this program, if it can be determined. More... | |
static string | get_environment_variable (const string &var) |
Returns the definition of the indicated environment variable, or the empty string if the variable is undefined. More... | |
static int | get_num_args () |
Returns the number of command-line arguments available, not counting arg 0, the binary name. More... | |
static bool | has_environment_variable (const string &var) |
Returns true if the indicated environment variable is defined. More... | |
static void | set_binary_name (const string &name) |
Do not use. More... | |
static void | set_dtool_name (const string &name) |
Do not use. More... | |
static void | set_environment_variable (const string &var, const string &value) |
Changes the definition of the indicated environment variable. More... | |
static void | shadow_environment_variable (const string &var, const string &value) |
Changes the apparent definition of the indicated environment variable by masking it within this class with a new value. More... | |
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.
Definition at line 33 of file executionEnvironment.h.
|
inlinestatic |
Removes a value set by a previous call to shadow_environment_variable(), and lets the actual value of the variable show again.
Definition at line 73 of file executionEnvironment.I.
References get_num_args().
Referenced by shadow_environment_variable().
|
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.
Definition at line 120 of file executionEnvironment.cxx.
References get_cwd(), and get_environment_variable().
Referenced by DCFile::clear(), Filename::expand_from(), and VirtualFileSystem::get_global_ptr().
|
inlinestatic |
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.
Definition at line 97 of file executionEnvironment.I.
References get_binary_name().
Referenced by get_num_args().
|
inlinestatic |
Returns the name of the binary executable that started this program, if it can be determined.
Definition at line 108 of file executionEnvironment.I.
References get_dtool_name().
Referenced by get_arg().
|
static |
Returns the name of the current working directory.
Definition at line 174 of file executionEnvironment.cxx.
References Filename::from_os_specific(), Filename::from_os_specific_w(), Filename::get_common_appdata_directory(), Filename::get_dirname(), Filename::get_filesystem_encoding(), Filename::get_home_directory(), Filename::get_temp_directory(), TextEncoder::get_text(), Filename::get_user_appdata_directory(), Filename::make_absolute(), Filename::make_true_case(), TextEncoder::set_encoding(), TextEncoder::set_wtext(), and Filename::to_os_specific().
Referenced by Filename::atomic_read_contents(), PandaFramework::event_f9(), expand_string(), EggFile::from_command_line(), Filename::get_common_appdata_directory(), VirtualFileSystem::get_global_ptr(), Filename::get_home_directory(), Filename::get_temp_directory(), Filename::get_user_appdata_directory(), Filename::make_absolute(), Filename::make_canonical(), FilenameUnifier::make_user_filename(), and CVSSourceTree::restore_cwd().
|
inlinestatic |
Returns the name of the libdtool DLL that is used in this program, if it can be determined.
Definition at line 119 of file executionEnvironment.I.
References set_binary_name().
Referenced by get_binary_name().
|
inlinestatic |
Returns the definition of the indicated environment variable, or the empty string if the variable is undefined.
Definition at line 35 of file executionEnvironment.I.
References set_environment_variable().
Referenced by expand_string(), has_environment_variable(), and ConfigPageManager::reload_implicit_pages().
|
inlinestatic |
Returns the number of command-line arguments available, not counting arg 0, the binary name.
Definition at line 84 of file executionEnvironment.I.
References get_arg().
Referenced by clear_shadow().
|
inlinestatic |
Returns true if the indicated environment variable is defined.
Definition at line 23 of file executionEnvironment.I.
References get_environment_variable().
|
inlinestatic |
Do not use.
Definition at line 129 of file executionEnvironment.I.
References set_dtool_name().
Referenced by get_dtool_name().
|
inlinestatic |
|
inlinestatic |
Changes the definition of the indicated environment variable.
Definition at line 46 of file executionEnvironment.I.
References shadow_environment_variable().
Referenced by get_environment_variable().
|
inlinestatic |
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.
Definition at line 61 of file executionEnvironment.I.
References clear_shadow().
Referenced by set_environment_variable().