set_environment_variable

This commit is contained in:
David Rose 2002-11-25 22:29:33 +00:00
parent e0d8d769c8
commit 03eb4ef3d3
3 changed files with 26 additions and 0 deletions

View File

@ -40,6 +40,17 @@ get_environment_variable(const string &var) {
return get_ptr()->ns_get_environment_variable(var);
}
////////////////////////////////////////////////////////////////////
// Function: ExecutionEnvironment::set_environment_variable
// Access: Public, Static
// Description: Changes the definition of the indicated environment
// variable.
////////////////////////////////////////////////////////////////////
INLINE void ExecutionEnvironment::
set_environment_variable(const string &var, const string &value) {
return get_ptr()->ns_set_environment_variable(var, value);
}
////////////////////////////////////////////////////////////////////
// Function: ExecutionEnvironment::get_num_args
// Access: Public, Static

View File

@ -195,6 +195,19 @@ ns_get_environment_variable(const string &var) const {
#endif
}
////////////////////////////////////////////////////////////////////
// Function: ExecutionEnvironment::ns_set_environment_variable
// Access: Private
// Description: Changes the definition of the indicated environment
// variable. The nonstatic implementation.
////////////////////////////////////////////////////////////////////
void ExecutionEnvironment::
ns_set_environment_variable(const string &var, const string &value) {
_variables[var] = value;
string put = var + "=" + value;
putenv(put.c_str());
}
////////////////////////////////////////////////////////////////////
// Function: ExecutionEnvironment::ns_get_num_args
// Access: Private

View File

@ -41,6 +41,7 @@ private:
public:
INLINE static bool has_environment_variable(const string &var);
INLINE static string get_environment_variable(const string &var);
INLINE static void set_environment_variable(const string &var, const string &value);
static string expand_string(const string &str);
@ -54,6 +55,7 @@ public:
private:
bool ns_has_environment_variable(const string &var) const;
string ns_get_environment_variable(const string &var) const;
void ns_set_environment_variable(const string &var, const string &value);
int ns_get_num_args() const;
string ns_get_arg(int n) const;