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

Add function to extract hash part of a store path

This commit is contained in:
Eelco Dolstra 2016-02-15 12:49:01 +01:00
parent 74f954ee62
commit d089372565
3 changed files with 15 additions and 2 deletions

View file

@ -61,7 +61,14 @@ Path followLinksToStorePath(const Path & path)
string storePathToName(const Path & path)
{
assertStorePath(path);
return string(path, settings.nixStore.size() + 34);
return string(path, settings.nixStore.size() + storePathHashLen + 2);
}
string storePathToHash(const Path & path)
{
assertStorePath(path);
return string(path, settings.nixStore.size() + 1, storePathHashLen);
}