Commit 44a261d4 authored by Isamu Mogi's avatar Isamu Mogi
Browse files

Read installed package info file as UTF-8

Currently installed package info file is written in UTF-8. So UTF-8
should be used explicitly or it can cause "invalid byte sequence"
error if system encoding is incompatible to UTF-8.
parent 3ef56020
...@@ -116,7 +116,7 @@ import qualified Distribution.Simple.Setup as Cabal ...@@ -116,7 +116,7 @@ import qualified Distribution.Simple.Setup as Cabal
, testCommand, TestFlags(..), emptyTestFlags ) , testCommand, TestFlags(..), emptyTestFlags )
import Distribution.Simple.Utils import Distribution.Simple.Utils
( createDirectoryIfMissingVerbose, rawSystemExit, comparing ( createDirectoryIfMissingVerbose, rawSystemExit, comparing
, writeFileAtomic, withTempFile , withFileContents ) , writeFileAtomic, withTempFile , withUTF8FileContents )
import Distribution.Simple.InstallDirs as InstallDirs import Distribution.Simple.InstallDirs as InstallDirs
( PathTemplate, fromPathTemplate, toPathTemplate, substPathTemplate ( PathTemplate, fromPathTemplate, toPathTemplate, substPathTemplate
, initialPathTemplateEnv, installDirsTemplateEnv ) , initialPathTemplateEnv, installDirsTemplateEnv )
...@@ -1350,7 +1350,7 @@ installUnpackedPackage verbosity buildLimit installLock numJobs ...@@ -1350,7 +1350,7 @@ installUnpackedPackage verbosity buildLimit installLock numJobs
Cabal.regGenPkgConf = toFlag (Just pkgConfFile) Cabal.regGenPkgConf = toFlag (Just pkgConfFile)
} }
setup Cabal.registerCommand registerFlags' mLogPath setup Cabal.registerCommand registerFlags' mLogPath
withFileContents pkgConfFile $ \pkgConfText -> withUTF8FileContents pkgConfFile $ \pkgConfText ->
case Installed.parseInstalledPackageInfo pkgConfText of case Installed.parseInstalledPackageInfo pkgConfText of
Installed.ParseFailed perror -> pkgConfParseFailed perror Installed.ParseFailed perror -> pkgConfParseFailed perror
Installed.ParseOk warns pkgConf -> do Installed.ParseOk warns pkgConf -> do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment