RSTools 3.1.0
Versatile C++20 utility library
Loading...
Searching...
No Matches
Environment.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <string>
5#include <string_view>
6
7namespace RST::System {
8
11
13 [[nodiscard]] std::optional<std::string> getEnv(std::string_view name);
14
16 bool setEnv(std::string_view name, std::string_view value, bool overwrite = true);
17
19 bool unsetEnv(std::string_view name);
21}
Portable access to system information, environment variables, files and paths.
Definition Environment.hpp:7
bool setEnv(std::string_view name, std::string_view value, bool overwrite=true)
Sets name to value, unless it is already set and overwrite is false; returns false on failure.
bool unsetEnv(std::string_view name)
Removes name from the environment; returns false on failure.
std::optional< std::string > getEnv(std::string_view name)
Value of the variable name, or std::nullopt if it is not set.