diff options
-rw-r--r-- | src/libstore/store.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 9c5d0bab8aae..73c09b27442f 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -401,6 +401,9 @@ Path addToStore(const Path & _srcPath) PathLocks outputLock(lockPaths); if (!isValidPath(dstPath)) { + + if (pathExists(dstPath)) deletePath(dstPath); + copyPath(srcPath, dstPath); Transaction txn(nixDB); @@ -426,6 +429,9 @@ void addTextToStore(const Path & dstPath, const string & s) PathLocks outputLock(lockPaths); if (!isValidPath(dstPath)) { + + if (pathExists(dstPath)) deletePath(dstPath); + writeStringToFile(dstPath, s); Transaction txn(nixDB); |