more OsPath conversion (639/749)

Sponsored-by: k0ld
This commit is contained in:
Joey Hess 2025-02-07 16:07:05 -04:00
parent a5d48edd94
commit c74c75b352
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
28 changed files with 147 additions and 132 deletions

View file

@ -9,7 +9,6 @@ module Command.ContentLocation where
import Command
import Annex.Content
import qualified Utility.RawFilePath as R
import qualified Data.ByteString.Char8 as B8
@ -23,10 +22,13 @@ cmd = noCommit $ noMessages $
run :: () -> SeekInput -> String -> Annex Bool
run _ _ p = do
let k = fromMaybe (giveup "bad key") $ deserializeKey p
maybe (return False) (\f -> liftIO (B8.putStrLn f) >> return True)
maybe (return False) emit
=<< inAnnex' (pure True) Nothing check k
where
check f = ifM (liftIO (R.doesPathExist f))
check f = ifM (liftIO (doesFileExist f))
( return (Just f)
, return Nothing
)
emit f = liftIO $ do
B8.putStrLn $ fromOsPath f
return True