Equivilant, just avoids some ugliness.
getViaTmpFromDisk :: RetrievalSecurityPolicy -> VerifyConfig -> Key -> AssociatedFile -> (OsPath -> Annex (Bool, Verification)) -> Annex Bool
getViaTmpFromDisk rsp v key af action = checkallowed $ do
tmpfile <- prepTmp key
- resuming <- liftIO $ R.doesPathExist $ fromOsPath tmpfile
+ resuming <- liftIO $ doesPathExist tmpfile
(ok, verification) <- action tmpfile
-- When the temp file already had content, we don't know if
-- that content is good or not, so only trust if it the action
, return False
)
where
- storeobject dest = ifM (liftIO $ R.doesPathExist $ fromOsPath dest)
+ storeobject dest = ifM (liftIO $ doesPathExist dest)
( alreadyhave
, adjustedBranchRefresh af $ modifyContentDir dest $ do
liftIO $ moveFile src dest
present _ | inanywhere = pure True
present d = presentInAnnex d
- presentInAnnex = R.doesPathExist . fromOsPath . contentfile
+ presentInAnnex = doesPathExist . contentfile
contentfile d = d </> takeFileName d
{- Things to do to record changes to content when shutting down.
import qualified Database.Keys
import Annex.InodeSentinal
import Utility.InodeCache
-import qualified Utility.RawFilePath as R
import qualified Git
import Config
{- Checks if a given key's content is currently present. -}
inAnnex :: Key -> Annex Bool
-inAnnex key = inAnnexCheck key $ liftIO . R.doesPathExist . fromOsPath
+inAnnex key = inAnnexCheck key $ liftIO . doesPathExist
{- Runs an arbitrary check on a key's content. -}
inAnnexCheck :: Key -> (OsPath -> Annex Bool) -> Annex Bool
enumSocketFiles = liftIO . go =<< sshCacheDir
where
go Nothing = return []
- go (Just dir) = filterM (R.doesPathExist . fromOsPath . socket2lock)
+ go (Just dir) = filterM (doesPathExist . socket2lock)
=<< filter (not . isLock)
<$> catchDefaultIO [] (dirContents dir)
idealloc <- calcRepo (gitAnnexLocation' (const (pure True)) key)
if loc == idealloc
then return True
- else ifM (liftIO $ R.doesPathExist $ fromOsPath loc)
+ else ifM (liftIO $ doesPathExist loc)
( moveobjdir loc idealloc
`catchNonAsync` \_e -> return True
, return True
checkKeySize _ KeyUnlockedThin _ = return True
checkKeySize key _ ai = do
file <- calcRepo $ gitAnnexLocation key
- ifM (liftIO $ R.doesPathExist (fromOsPath file))
+ ifM (liftIO $ doesPathExist file)
( checkKeySizeOr badContent key file ai
, return True
)
checkBackend :: Key -> KeyStatus -> AssociatedFile -> Annex Bool
checkBackend key keystatus afile = do
content <- calcRepo (gitAnnexLocation key)
- ifM (liftIO $ R.doesPathExist (fromOsPath content))
+ ifM (liftIO $ doesPathExist content)
( ifM (pure (isKeyUnlockedThin keystatus) <&&> (not <$> isUnmodified key content))
( nocheck
, do