mirror of
https://github.com/NixOS/nix
synced 2025-07-05 20:41:47 +02:00
This ended up motivating a good deal of other infra improvements in order to get Windows right: - `OsString` to complement `std::filesystem::path` - env var code for working with the underlying `OsString`s - Rename `PATHNG_LITERAL` to `OS_STR` - `NativePathTrait` renamed to `OsPathTrait`, given a character template parameter until #9205 is complete. Split `tests.cc` matching split of `util.{cc,hh}` last year. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
22 lines
371 B
C++
22 lines
371 B
C++
#include <cstdlib>
|
|
|
|
#include "environment-variables.hh"
|
|
|
|
namespace nix {
|
|
|
|
int setEnv(const char * name, const char * value)
|
|
{
|
|
return ::setenv(name, value, 1);
|
|
}
|
|
|
|
std::optional<std::string> getEnvOs(const std::string & key)
|
|
{
|
|
return getEnv(key);
|
|
}
|
|
|
|
int setEnvOs(const OsString & name, const OsString & value)
|
|
{
|
|
return setEnv(name.c_str(), value.c_str());
|
|
}
|
|
|
|
}
|