Cleanup reading of file.

This commit is contained in:
Erik Svedäng 2018-02-19 16:24:35 +01:00
parent e35178ccf8
commit 987c2bb172

View File

@ -7,7 +7,6 @@ import Data.Maybe (fromJust, mapMaybe, isJust)
import Control.Monad.State
import Control.Monad.State.Lazy (StateT(..), runStateT, liftIO, modify, get, put)
import System.Exit (exitSuccess, exitFailure, exitWith, ExitCode(..))
import System.IO (hPutStr)
import qualified System.IO as SysIO
import System.Directory (doesPathExist)
import Control.Concurrent (forkIO)
@ -795,10 +794,9 @@ commandLoad [XObj (Str path) _ _] =
return dynamicNil
firstPathFound : _ ->
do contents <- liftIO $ do --putStrLn ("Will load '" ++ firstPathFound ++ "'")
-- readFile firstPathFound
h <- SysIO.openFile firstPathFound SysIO.ReadMode
SysIO.hSetEncoding h SysIO.utf8
SysIO.hGetContents h
handle <- SysIO.openFile firstPathFound SysIO.ReadMode
SysIO.hSetEncoding handle SysIO.utf8
SysIO.hGetContents handle
let files = projectFiles proj
files' = if firstPathFound `elem` files
then files