{-# LANGUAGE CPP #-}

module System.File.PlatformPath where

#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
import qualified System.File.Windows as P
#else
import qualified System.File.Posix as P
#endif

import Control.Exception (bracket)
import System.IO (IOMode(..), Handle, hSetBinaryMode, hClose)
import System.OsPath.Types

import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BSL

#define FILE_PATH PlatformPath
#include "Common.hs"

-- | Open a file and return the 'Handle'.
openFile :: PlatformPath -> IOMode -> IO Handle
openFile :: PlatformPath -> IOMode -> IO Handle
openFile PlatformPath
fp = PlatformPath -> IOMode -> IO Handle
P.openFile PlatformPath
fp

-- | Open an existing file and return the 'Handle'.
openExistingFile :: PlatformPath -> IOMode -> IO Handle
openExistingFile :: PlatformPath -> IOMode -> IO Handle
openExistingFile PlatformPath
fp = PlatformPath -> IOMode -> IO Handle
P.openExistingFile PlatformPath
fp