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
|
@ -27,6 +27,8 @@ import Control.Monad.Catch
|
|||
import Utility.Exception
|
||||
import Utility.FileSystemEncoding
|
||||
import qualified Utility.RawFilePath as R
|
||||
import qualified Utility.FileIO as F
|
||||
import Utility.OsPath
|
||||
|
||||
{- Applies a conversion function to a file's mode. -}
|
||||
modifyFileMode :: RawFilePath -> (FileMode -> FileMode) -> IO ()
|
||||
|
@ -178,7 +180,7 @@ writeFileProtected' :: RawFilePath -> (Handle -> IO ()) -> IO ()
|
|||
writeFileProtected' file writer = bracket setup cleanup writer
|
||||
where
|
||||
setup = do
|
||||
h <- protectedOutput $ openFile (fromRawFilePath file) WriteMode
|
||||
h <- protectedOutput $ F.openFile (toOsPath file) WriteMode
|
||||
void $ tryIO $ modifyFileMode file $ removeModes otherGroupModes
|
||||
return h
|
||||
cleanup = hClose
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue