add file-io to build-depends when building with OsPath flag
Partly converted code to use functions from it, though more remain unconverted. Most of withFile and openFile now use it.
This commit is contained in:
parent
85efc13e3a
commit
1faa3af9cd
20 changed files with 178 additions and 68 deletions
|
@ -18,6 +18,8 @@ module Utility.FileSize (
|
|||
import Control.Exception (bracket)
|
||||
import System.IO
|
||||
import Utility.FileSystemEncoding
|
||||
import qualified Utility.FileIO as F
|
||||
import Utility.OsPath
|
||||
#else
|
||||
import System.PosixCompat.Files (fileSize)
|
||||
#endif
|
||||
|
@ -36,7 +38,7 @@ getFileSize :: R.RawFilePath -> IO FileSize
|
|||
#ifndef mingw32_HOST_OS
|
||||
getFileSize f = fmap (fromIntegral . fileSize) (R.getFileStatus f)
|
||||
#else
|
||||
getFileSize f = bracket (openFile (fromRawFilePath f) ReadMode) hClose hFileSize
|
||||
getFileSize f = bracket (F.openFile (toOsPath f) ReadMode) hClose hFileSize
|
||||
#endif
|
||||
|
||||
{- Gets the size of the file, when its FileStatus is already known.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue