From be1a917beb4577dd359a5e8ea17ca69dd228e6ae Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 21 Jun 2004 07:46:02 +0000 Subject: [PATCH] * Remove obstructing invalid store paths add[Text]ToStore(). --- src/libstore/store.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 9c5d0bab8a..73c09b2744 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);