1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 00:11:17 +02:00

absPath(): Use std::optional

This commit is contained in:
Eelco Dolstra 2020-01-08 15:34:06 +01:00
parent 6fadb3fc03
commit 1bf9eb21b7
2 changed files with 4 additions and 4 deletions

View file

@ -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);
}