Medical Imaging Interaction Toolkit
2025.08.99-f7084adb
Medical Imaging Interaction Toolkit
|
Functions for querying and modifying environment variables in MITK. More...
Functions | |
MITKCORE_EXPORT std::optional< std::string > | mitk::GetEnv (const std::string &name) |
Retrieve the value of an environment variable. More... | |
MITKCORE_EXPORT bool | mitk::SetEnv (const std::string &name, const std::string &value) |
Set the value of an environment variable. More... | |
MITKCORE_EXPORT bool | mitk::UnsetEnv (const std::string &name) |
Remove an environment variable. More... | |
MITKCORE_EXPORT bool | mitk::AddPathEnv (const fs::path &pathEntry) |
Add a directory to the PATH environment variable. More... | |
MITKCORE_EXPORT bool | mitk::RemovePathEnv (const fs::path &pathEntry) |
Remove a directory from the PATH environment variable. More... | |
Functions for querying and modifying environment variables in MITK.
These functions provide a platform-independent interface for retrieving, setting, and removing environment variables, as well as manipulating the PATH
variable.
MITKCORE_EXPORT bool mitk::AddPathEnv | ( | const fs::path & | pathEntry | ) |
Add a directory to the PATH environment variable.
The path is normalized before being added. If it already exists in PATH, no changes are made.
pathEntry | Directory to add to PATH. |
true
if the path was added or already existed, false
if the operation failed. MITKCORE_EXPORT std::optional<std::string> mitk::GetEnv | ( | const std::string & | name | ) |
Retrieve the value of an environment variable.
This function looks up the given environment variable name and returns its value if it exists.
name | Name of the environment variable. |
std::nullopt
if not found. MITKCORE_EXPORT bool mitk::RemovePathEnv | ( | const fs::path & | pathEntry | ) |
Remove a directory from the PATH environment variable.
The path is normalized before comparison. If the path is not present, no changes are made.
pathEntry | Directory to remove from PATH. |
true
if the path was removed or was not present, false
if the operation failed. MITKCORE_EXPORT bool mitk::SetEnv | ( | const std::string & | name, |
const std::string & | value | ||
) |
Set the value of an environment variable.
If the environment variable already exists, its value is overwritten.
name | Name of the environment variable. |
value | New value for the environment variable. |
true
if the variable was successfully set, false
otherwise. MITKCORE_EXPORT bool mitk::UnsetEnv | ( | const std::string & | name | ) |
Remove an environment variable.
The variable is removed from the current process environment.
name | Name of the environment variable to remove. |
true
if the variable was successfully removed, false
otherwise.