michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * Scriptable access to the current process environment. michael@0: * michael@0: */ michael@0: [scriptable, uuid(101d5941-d820-4e85-a266-9a3469940807)] michael@0: interface nsIEnvironment : nsISupports michael@0: { michael@0: /** michael@0: * Set the value of an environment variable. michael@0: * michael@0: * @param aName the variable name to set. michael@0: * @param aValue the value to set. michael@0: */ michael@0: void set(in AString aName, in AString aValue); michael@0: michael@0: /** michael@0: * Get the value of an environment variable. michael@0: * michael@0: * @param aName the variable name to retrieve. michael@0: * @return returns the value of the env variable. An empty string michael@0: * will be returned when the env variable does not exist or michael@0: * when the value itself is an empty string - please use michael@0: * |exists()| to probe whether the env variable exists michael@0: * or not. michael@0: */ michael@0: AString get(in AString aName); michael@0: michael@0: /** michael@0: * Check the existence of an environment variable. michael@0: * This method checks whether an environment variable is present in michael@0: * the environment or not. michael@0: * michael@0: * - For Unix/Linux platforms we follow the Unix definition: michael@0: * An environment variable exists when |getenv()| returns a non-NULL value. michael@0: * An environment variable does not exist when |getenv()| returns NULL. michael@0: * - For non-Unix/Linux platforms we have to fall back to a michael@0: * "portable" definition (which is incorrect for Unix/Linux!!!!) michael@0: * which simply checks whether the string returned by |Get()| is empty michael@0: * or not. michael@0: * michael@0: * @param aName the variable name to probe. michael@0: * @return if the variable has been set, the value returned is michael@0: * PR_TRUE. If the variable was not defined in the michael@0: * environment PR_FALSE will be returned. michael@0: */ michael@0: boolean exists(in AString aName); michael@0: }; michael@0: