HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
setenv.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_TF_SETENV_H
8 #define PXR_BASE_TF_SETENV_H
9 
10 /// \file tf/setenv.h
11 /// \ingroup group_tf_SystemsExt
12 /// Functions for setting and unsetting environment variables
13 
14 #include "pxr/pxr.h"
15 
16 #include "pxr/base/tf/api.h"
17 #include <string>
18 
20 
21 /// Set an environment variable.
22 ///
23 /// Sets an environment variable and ensures that it appears in the Python
24 /// environment if Python is initialized. If Python has not yet been
25 /// initialized, the variable \p envName is set to \p value in the environment
26 /// using \c setenv. Otherwise, it is set both in the environment and in
27 /// Python using \c TfPySetenv. The new value overwrites any existing value.
28 ///
29 /// If the value cannot be set, false is returned and a warning is posted.
30 /// Otherwise, the return value is true.
31 ///
32 /// \ingroup group_tf_SystemsExt
33 TF_API
34 bool TfSetenv(const std::string& envName, const std::string& value);
35 
36 /// Unset an environment variable.
37 ///
38 /// Unsets an environment variable and ensures that it is also removed from
39 /// the Python environment if Python is initialized. If Python has not yet
40 /// been initialized, the variable \p envName is unset in the environment
41 /// using \c unsetenv. Otherwise, it is unset both in the environment and in
42 /// Python using \c TfPyUnsetenv.
43 ///
44 /// If the value cannot be unset, false is returned and a warning is posted.
45 /// Otherwise, the return value is true.
46 ///
47 /// \ingroup group_tf_SystemsExt
48 TF_API
49 bool TfUnsetenv(const std::string& envName);
50 
52 
53 #endif // PXR_BASE_TF_SETENV_H
TF_API bool TfUnsetenv(const std::string &envName)
#define TF_API
Definition: api.h:23
GLsizei const GLfloat * value
Definition: glcorearb.h:824
PXR_NAMESPACE_OPEN_SCOPE TF_API bool TfSetenv(const std::string &envName, const std::string &value)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74