convert from readFileStrict

This removes that function, using file-io readFile' instead.

Had to deal with newline conversion, which readFileStrict does on
Windows. In a few cases, that was pretty ugly to deal with.

Sponsored-by: Kevin Mueller
This commit is contained in:
Joey Hess 2025-01-22 16:19:06 -04:00
parent de1af273e0
commit 6e27b0d4d1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
19 changed files with 94 additions and 71 deletions

View file

@ -20,6 +20,7 @@ import Annex.Content
import Utility.Tmp
import Logs
import Messages.Progress
import qualified Utility.FileIO as F
olddir :: Git.Repo -> FilePath
olddir g
@ -138,10 +139,11 @@ gitAttributesUnWrite repo = do
let attributes = Git.attributes repo
let attributes' = fromRawFilePath attributes
whenM (doesFileExist attributes') $ do
c <- readFileStrict attributes'
c <- map decodeBS . fileLines'
<$> F.readFile' (toOsPath attributes)
liftIO $ viaTmp (writeFile . fromRawFilePath . fromOsPath)
(toOsPath attributes)
(unlines $ filter (`notElem` attrLines) $ lines c)
(unlines $ filter (`notElem` attrLines) c)
Git.Command.run [Param "add", File attributes'] repo
stateDir :: FilePath

View file

@ -119,8 +119,8 @@ goodContent key file =
recordedInodeCache :: Key -> Annex [InodeCache]
recordedInodeCache key = withInodeCacheFile key $ \f ->
liftIO $ catchDefaultIO [] $
mapMaybe readInodeCache . lines
<$> readFileStrict (fromRawFilePath f)
mapMaybe (readInodeCache . decodeBS) . fileLines'
<$> F.readFile' (toOsPath f)
{- Removes an inode cache. -}
removeInodeCache :: Key -> Annex ()