replace R.doesPathExist with doesPathExist

Equivilant, just avoids some ugliness.
This commit is contained in:
Joey Hess 2025-02-11 12:46:14 -04:00
parent 5dbaaae299
commit 3bbabd6778
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 8 additions and 9 deletions

View file

@ -387,7 +387,7 @@ getViaTmp rsp v key af sz action =
getViaTmpFromDisk :: RetrievalSecurityPolicy -> VerifyConfig -> Key -> AssociatedFile -> (OsPath -> Annex (Bool, Verification)) -> Annex Bool getViaTmpFromDisk :: RetrievalSecurityPolicy -> VerifyConfig -> Key -> AssociatedFile -> (OsPath -> Annex (Bool, Verification)) -> Annex Bool
getViaTmpFromDisk rsp v key af action = checkallowed $ do getViaTmpFromDisk rsp v key af action = checkallowed $ do
tmpfile <- prepTmp key tmpfile <- prepTmp key
resuming <- liftIO $ R.doesPathExist $ fromOsPath tmpfile resuming <- liftIO $ doesPathExist tmpfile
(ok, verification) <- action tmpfile (ok, verification) <- action tmpfile
-- When the temp file already had content, we don't know if -- 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 -- that content is good or not, so only trust if it the action
@ -521,7 +521,7 @@ moveAnnex key af src = ifM (checkSecureHashes' key)
, return False , return False
) )
where where
storeobject dest = ifM (liftIO $ R.doesPathExist $ fromOsPath dest) storeobject dest = ifM (liftIO $ doesPathExist dest)
( alreadyhave ( alreadyhave
, adjustedBranchRefresh af $ modifyContentDir dest $ do , adjustedBranchRefresh af $ modifyContentDir dest $ do
liftIO $ moveFile src dest liftIO $ moveFile src dest
@ -842,7 +842,7 @@ listKeys' keyloc want = do
present _ | inanywhere = pure True present _ | inanywhere = pure True
present d = presentInAnnex d present d = presentInAnnex d
presentInAnnex = R.doesPathExist . fromOsPath . contentfile presentInAnnex = doesPathExist . contentfile
contentfile d = d </> takeFileName d contentfile d = d </> takeFileName d
{- Things to do to record changes to content when shutting down. {- Things to do to record changes to content when shutting down.

View file

@ -33,7 +33,6 @@ import Types.RepoVersion
import qualified Database.Keys import qualified Database.Keys
import Annex.InodeSentinal import Annex.InodeSentinal
import Utility.InodeCache import Utility.InodeCache
import qualified Utility.RawFilePath as R
import qualified Git import qualified Git
import Config import Config
@ -43,7 +42,7 @@ import Annex.Perms
{- Checks if a given key's content is currently present. -} {- Checks if a given key's content is currently present. -}
inAnnex :: Key -> Annex Bool 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. -} {- Runs an arbitrary check on a key's content. -}
inAnnexCheck :: Key -> (OsPath -> Annex Bool) -> Annex Bool inAnnexCheck :: Key -> (OsPath -> Annex Bool) -> Annex Bool

View file

@ -292,7 +292,7 @@ enumSocketFiles :: Annex [OsPath]
enumSocketFiles = liftIO . go =<< sshCacheDir enumSocketFiles = liftIO . go =<< sshCacheDir
where where
go Nothing = return [] go Nothing = return []
go (Just dir) = filterM (R.doesPathExist . fromOsPath . socket2lock) go (Just dir) = filterM (doesPathExist . socket2lock)
=<< filter (not . isLock) =<< filter (not . isLock)
<$> catchDefaultIO [] (dirContents dir) <$> catchDefaultIO [] (dirContents dir)

View file

@ -271,7 +271,7 @@ fixObjectLocation key = do
idealloc <- calcRepo (gitAnnexLocation' (const (pure True)) key) idealloc <- calcRepo (gitAnnexLocation' (const (pure True)) key)
if loc == idealloc if loc == idealloc
then return True then return True
else ifM (liftIO $ R.doesPathExist $ fromOsPath loc) else ifM (liftIO $ doesPathExist loc)
( moveobjdir loc idealloc ( moveobjdir loc idealloc
`catchNonAsync` \_e -> return True `catchNonAsync` \_e -> return True
, return True , return True
@ -439,7 +439,7 @@ checkKeySize :: Key -> KeyStatus -> ActionItem -> Annex Bool
checkKeySize _ KeyUnlockedThin _ = return True checkKeySize _ KeyUnlockedThin _ = return True
checkKeySize key _ ai = do checkKeySize key _ ai = do
file <- calcRepo $ gitAnnexLocation key file <- calcRepo $ gitAnnexLocation key
ifM (liftIO $ R.doesPathExist (fromOsPath file)) ifM (liftIO $ doesPathExist file)
( checkKeySizeOr badContent key file ai ( checkKeySizeOr badContent key file ai
, return True , return True
) )
@ -504,7 +504,7 @@ checkKeyUpgrade _ _ _ (AssociatedFile Nothing) =
checkBackend :: Key -> KeyStatus -> AssociatedFile -> Annex Bool checkBackend :: Key -> KeyStatus -> AssociatedFile -> Annex Bool
checkBackend key keystatus afile = do checkBackend key keystatus afile = do
content <- calcRepo (gitAnnexLocation key) content <- calcRepo (gitAnnexLocation key)
ifM (liftIO $ R.doesPathExist (fromOsPath content)) ifM (liftIO $ doesPathExist content)
( ifM (pure (isKeyUnlockedThin keystatus) <&&> (not <$> isUnmodified key content)) ( ifM (pure (isKeyUnlockedThin keystatus) <&&> (not <$> isUnmodified key content))
( nocheck ( nocheck
, do , do