mirror of
https://github.com/NixOS/nix
synced 2025-06-30 19:57:59 +02:00
* Make dbRefs a mapping from Hash to [Path].
This commit is contained in:
parent
609a224848
commit
5895c160c4
11 changed files with 172 additions and 49 deletions
17
src/util.cc
17
src/util.cc
|
@ -33,13 +33,18 @@ string absPath(string path, string dir)
|
|||
dir = buf;
|
||||
}
|
||||
path = dir + "/" + path;
|
||||
/* !!! canonicalise */
|
||||
char resolved[PATH_MAX];
|
||||
if (!realpath(path.c_str(), resolved))
|
||||
throw SysError(format("cannot canonicalise path %1%") % path);
|
||||
path = resolved;
|
||||
}
|
||||
return path;
|
||||
return canonPath(path);
|
||||
}
|
||||
|
||||
|
||||
string canonPath(const string & path)
|
||||
{
|
||||
char resolved[PATH_MAX];
|
||||
if (!realpath(path.c_str(), resolved))
|
||||
throw SysError(format("cannot canonicalise path `%1%'") % path);
|
||||
/* !!! check that this removes trailing slashes */
|
||||
return resolved;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue