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

Merge branch 'dirOf-relative' of https://github.com/lheckemann/nix

This commit is contained in:
Eelco Dolstra 2018-09-13 14:33:12 +02:00
commit 8327a7a8fa
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 2 additions and 2 deletions

View file

@ -167,7 +167,7 @@ Path dirOf(const Path & path)
{
Path::size_type pos = path.rfind('/');
if (pos == string::npos)
throw Error(format("invalid file name '%1%'") % path);
return ".";
return pos == 0 ? "/" : Path(path, 0, pos);
}