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:
Joey Hess 2025-01-21 14:26:04 -04:00
parent 85efc13e3a
commit 1faa3af9cd
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
20 changed files with 178 additions and 68 deletions

View file

@ -11,10 +11,9 @@
module Utility.OsPath where
import Utility.FileSystemEncoding
#ifdef WITH_OSPATH
import Utility.RawFilePath
import System.OsPath
import "os-string" System.OsString.Internal.Types
import qualified Data.ByteString.Short as S
@ -36,4 +35,15 @@ fromOsPath = S.fromShort . getWindowsString . getOsString
fromOsPath = S.fromShort . getPosixString . getOsString
#endif
#endif /* WITH_OSPATH */
#else
{- When not building with WITH_OSPATH, use FilePath. This allows
- using functions from legacy FilePath libraries interchangeably with
- newer OsPath libraries.
- -}
type OsPath = FilePath
toOsPath :: RawFilePath -> OsPath
toOsPath = fromRawFilePath
fromOsPath :: OsPath -> RawFilePath
fromOsPath = toRawFilePath
#endif