about summary refs log tree commit diff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-15T11·49+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-15T14·01+0100
commitd0893725651a7657eab21ec4aad97146d2294c98 (patch)
tree4ec1213f2f8b7892bbd2c10f83ec0366afef16ec /src/libstore/store-api.cc
parent74f954ee6253ce1f934327d6c050fdbdeca8fac2 (diff)
Add function to extract hash part of a store path
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 039d07e29b3e..2f44401827f0 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -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);
 }