aboutsummaryrefslogtreecommitdiff
path: root/src/nix/doctor.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-11-22 16:06:44 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-11-22 16:18:13 +0100
commitba87b08f8529e4d9f8c58d8c625152058ceadb75 (patch)
treec78196cbeb52273c3d5b99ff8dee314108940b9a /src/nix/doctor.cc
parentfd900c45b5ff9c6dc7f3ec814eca4ad603720899 (diff)
getEnv(): Return std::optional
This allows distinguishing between an empty value and no value.
Diffstat (limited to 'src/nix/doctor.cc')
-rw-r--r--src/nix/doctor.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix/doctor.cc b/src/nix/doctor.cc
index 795236c5f..481c93b45 100644
--- a/src/nix/doctor.cc
+++ b/src/nix/doctor.cc
@@ -68,7 +68,7 @@ struct CmdDoctor : StoreCommand
{
PathSet dirs;
- for (auto & dir : tokenizeString<Strings>(getEnv("PATH"), ":"))
+ for (auto & dir : tokenizeString<Strings>(getEnv("PATH").value_or(""), ":"))
if (pathExists(dir + "/nix-env"))
dirs.insert(dirOf(canonPath(dir + "/nix-env", true)));
@@ -87,7 +87,7 @@ struct CmdDoctor : StoreCommand
{
PathSet dirs;
- for (auto & dir : tokenizeString<Strings>(getEnv("PATH"), ":")) {
+ for (auto & dir : tokenizeString<Strings>(getEnv("PATH").value_or(""), ":")) {
Path profileDir = dirOf(dir);
try {
Path userEnv = canonPath(profileDir, true);