fix handling of removal of keys that are not present
This commit is contained in:
parent
80cc554c82
commit
153ace4524
2 changed files with 8 additions and 2 deletions
|
@ -160,9 +160,15 @@ remove d k = liftIO $ do
|
||||||
- before it can delete them. -}
|
- before it can delete them. -}
|
||||||
void $ tryIO $ mapM_ allowWrite =<< dirContents dir
|
void $ tryIO $ mapM_ allowWrite =<< dirContents dir
|
||||||
#endif
|
#endif
|
||||||
catchBoolIO $ do
|
ok <- catchBoolIO $ do
|
||||||
removeDirectoryRecursive dir
|
removeDirectoryRecursive dir
|
||||||
return True
|
return True
|
||||||
|
{- Removing the subdirectory will fail if it doesn't exist.
|
||||||
|
- But, we want to succeed in that case, as long as the directory
|
||||||
|
- remote's top-level directory does exist. -}
|
||||||
|
if ok
|
||||||
|
then return ok
|
||||||
|
else doesDirectoryExist d <&&> (not <$> doesDirectoryExist dir)
|
||||||
where
|
where
|
||||||
dir = storeDir d k
|
dir = storeDir d k
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ data RemoteA a = Remote {
|
||||||
retrieveKeyFile :: Key -> AssociatedFile -> FilePath -> MeterUpdate -> a Bool,
|
retrieveKeyFile :: Key -> AssociatedFile -> FilePath -> MeterUpdate -> a Bool,
|
||||||
-- retrieves a key's contents to a tmp file, if it can be done cheaply
|
-- retrieves a key's contents to a tmp file, if it can be done cheaply
|
||||||
retrieveKeyFileCheap :: Key -> FilePath -> a Bool,
|
retrieveKeyFileCheap :: Key -> FilePath -> a Bool,
|
||||||
-- removes a key's contents
|
-- removes a key's contents (succeeds if the contents are not present)
|
||||||
removeKey :: Key -> a Bool,
|
removeKey :: Key -> a Bool,
|
||||||
-- Checks if a key is present in the remote; if the remote
|
-- Checks if a key is present in the remote; if the remote
|
||||||
-- cannot be accessed returns a Left error message.
|
-- cannot be accessed returns a Left error message.
|
||||||
|
|
Loading…
Reference in a new issue