WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIEnvironment

IID:101d5941-d820-4e85-a266-9a3469940807
Inherits From:nsISupports

Scriptable access to the current process environment.

This interface is implemented by the following components:


Methods

PRBool exists ( AString name ) AString get ( AString name ) void set ( AString name , AString value )

PRBool exists ( AString name )

Check the existence of an environment variable. This method checks whether an environment variable is present in the environment or not.

- For Unix/Linux platforms we follow the Unix definition: An environment variable exists when getenv() returns a non-NULL value. An environment variable does not exist when getenv() returns NULL. - For non-Unix/Linux platforms we have to fall back to a "portable" definition (which is incorrect for Unix/Linux!!!!) which simply checks whether the string returned by Get() is empty or not.

Arguments:
name: the variable name to probe.
Returns:
if the variable has been set, the value returned is PR_TRUE. If the variable was not defined in the environment PR_FALSE will be returned.

AString get ( AString name )

Get the value of an environment variable.

Arguments:
name: the variable name to retrieve.
Returns:
returns the value of the env variable. An empty string will be returned when the env variable does not exist or when the value itself is an empty string - please use |exists()| to probe whether the env variable exists or not.

void set ( AString name , AString value )

Set the value of an environment variable.

Arguments:
name: the variable name to set.
value: the value to set.

Reference documentation is generated from Mozilla's source.