Skip to content

Commit

Permalink
Fixed #5741.
Browse files Browse the repository at this point in the history
  • Loading branch information
nad authored and andreasabel committed Mar 14, 2022
1 parent d6226d9 commit 4f015eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/full/Agda/Interaction/Library.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import Agda.Utils.Environment
import Agda.Utils.FileName
import Agda.Utils.Functor ( (<&>) )
import Agda.Utils.IO ( catchIO )
import qualified Agda.Utils.IO.UTF8 as UTF8
import Agda.Utils.List
import Agda.Utils.List1 ( List1 )
import qualified Agda.Utils.List1 as List1
Expand Down Expand Up @@ -257,7 +258,7 @@ readDefaultsFile = do
agdaDir <- liftIO getAgdaAppDir
let file = agdaDir </> defaultsFile
ifNotM (liftIO $ doesFileExist file) (return []) $ {-else-} do
ls <- liftIO $ map snd . stripCommentLines <$> readFile file
ls <- liftIO $ map snd . stripCommentLines <$> UTF8.readFile file
return $ concatMap splitCommas ls
`catchIO` \ e -> do
raiseErrors' [ OtherError $ unlines ["Failed to read defaults file.", show e] ]
Expand Down Expand Up @@ -301,7 +302,7 @@ getInstalledLibraries overrideLibFile = mkLibM [] $ do
Left err -> raiseErrors' [OtherError err] >> return []
Right file -> do
if not (lfExists file) then return [] else do
ls <- liftIO $ stripCommentLines <$> readFile (lfPath file)
ls <- liftIO $ stripCommentLines <$> UTF8.readFile (lfPath file)
files <- liftIO $ sequence [ (i, ) <$> expandEnvironmentVariables s | (i, s) <- ls ]
parseLibFiles (Just file) $ nubOn snd files
`catchIO` \ e -> do
Expand Down Expand Up @@ -370,7 +371,7 @@ getTrustedExecutables
getTrustedExecutables = mkLibM [] $ do
file <- liftIO getExecutablesFile
if not (efExists file) then return Map.empty else do
es <- liftIO $ stripCommentLines <$> readFile (efPath file)
es <- liftIO $ stripCommentLines <$> UTF8.readFile (efPath file)
files <- liftIO $ sequence [ (i, ) <$> expandEnvironmentVariables s | (i, s) <- es ]
tmp <- parseExecutablesFile file $ nubOn snd files
return tmp
Expand Down
3 changes: 2 additions & 1 deletion src/full/Agda/Interaction/Library/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import Agda.Interaction.Library.Base

import Agda.Utils.Applicative
import Agda.Utils.IO ( catchIO )
import qualified Agda.Utils.IO.UTF8 as UTF8
import Agda.Utils.Lens
import Agda.Utils.List ( duplicates )
import Agda.Utils.String ( ltrim )
Expand Down Expand Up @@ -109,7 +110,7 @@ agdaLibFields =
--
parseLibFile :: FilePath -> IO (P AgdaLibFile)
parseLibFile file =
(fmap setPath . parseLib <$> readFile file) `catchIO` \e ->
(fmap setPath . parseLib <$> UTF8.readFile file) `catchIO` \e ->
return $ throwError $ unlines
[ "Failed to read library file " ++ file ++ "."
, "Reason: " ++ show e
Expand Down

0 comments on commit 4f015eb

Please sign in to comment.