about summary refs log tree commit diff
path: root/src/libstore/store-api.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-01-12T16·31+0100
committerEelco Dolstra <edolstra@gmail.com>2018-01-12T16·31+0100
commit74f75c855837bce7f48491e9ce8ac03794e5b40d (patch)
treeedf3ff8bfd9ebd4bf038a78dc7991ebe3f1b28e2 /src/libstore/store-api.hh
parent435ccc798077e6291fd34fd1720c6abcf3521557 (diff)
import, builtins.readFile: Handle diverted stores
Fixes #1791
Diffstat (limited to 'src/libstore/store-api.hh')
-rw-r--r--src/libstore/store-api.hh10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index d1e1b5d6f452..c0e735cd314c 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -597,6 +597,11 @@ public:
        "nix-cache-info" file. Lower value means higher priority. */
     virtual int getPriority() { return 0; }
 
+    virtual Path toRealPath(const Path & storePath)
+    {
+        return storePath;
+    }
+
 protected:
 
     Stats stats;
@@ -639,9 +644,10 @@ public:
 
     virtual Path getRealStoreDir() { return storeDir; }
 
-    Path toRealPath(const Path & storePath)
+    Path toRealPath(const Path & storePath) override
     {
-        return getRealStoreDir() + "/" + baseNameOf(storePath);
+        assert(isInStore(storePath));
+        return getRealStoreDir() + "/" + std::string(storePath, storeDir.size() + 1);
     }
 
     std::shared_ptr<std::string> getBuildLog(const Path & path) override;