diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-01-08 15:34:06 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-01-21 22:39:43 +0100 |
commit | 1bf9eb21b75f0d93d9c1633ea2e6fdf840047e79 (patch) | |
tree | af0300b5aae345d2c2b515c52cd2e51a9c17fc1a /src/libutil/util.cc | |
parent | 6fadb3fc03a1a3d51a1aaea003bfbe347c3879b3 (diff) |
absPath(): Use std::optional
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 dda0950a1..ab63ceb10 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -98,10 +98,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'. */ @@ -117,7 +117,7 @@ Path absPath(Path path, Path dir) free(buf); #endif } - path = dir + "/" + path; + path = *dir + "/" + path; } return canonPath(path); } |