diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-01-08 15:34:06 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-03-24 14:25:28 +0100 |
commit | 4260a22a55d7afc931b22e8c41282fbd0ed18a77 (patch) | |
tree | c7fda769c2900e3259dbca031968bc9cb080335b /src/libutil/util.cc | |
parent | f9611c7ae48abd4506a93691c25f067a0e8e73b4 (diff) |
absPath(): Use std::optional
(cherry picked from commit 1bf9eb21b75f0d93d9c1633ea2e6fdf840047e79)
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 52a1394f2..097ff210a 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -97,10 +97,10 @@ void replaceEnv(std::map<std::string, std::string> newEnv) } -Path absPath(Path path, Path dir) +Path absPath(Path path, std::optional<Path> dir) { if (path[0] != '/') { - if (dir == "") { + if (!dir) { #ifdef __GNU__ /* GNU (aka. GNU/Hurd) doesn't have any limitation on path lengths and doesn't define `PATH_MAX'. */ @@ -116,7 +116,7 @@ Path absPath(Path path, Path dir) free(buf); #endif } - path = dir + "/" + path; + path = *dir + "/" + path; } return canonPath(path); } |