add System.FilePath to this conversion
It seems to make sense to convert both System.Directory and System.FilePath uses to OsPath in one go. This will generally look like replacing RawFilePath with OsPath in type signatures, and will be driven by the now absolutely massive pile of compile errors. Got a few modules building in this new regime. Sponsored-by: Jack Hill
This commit is contained in:
parent
05bdce328d
commit
c3c8870752
6 changed files with 53 additions and 46 deletions
|
@ -13,17 +13,24 @@
|
|||
module Utility.OsPath (
|
||||
OsPath,
|
||||
OsString,
|
||||
RawFilePath,
|
||||
literalOsPath,
|
||||
toOsPath,
|
||||
fromOsPath,
|
||||
module X,
|
||||
getSearchPath,
|
||||
) where
|
||||
|
||||
import Utility.FileSystemEncoding
|
||||
#ifdef WITH_OSPATH
|
||||
import System.OsPath as X hiding (OsPath, OsString)
|
||||
import System.OsPath
|
||||
import "os-string" System.OsString.Internal.Types
|
||||
import qualified Data.ByteString.Short as S
|
||||
import qualified System.FilePath.ByteString as PB
|
||||
#else
|
||||
import System.FilePath.ByteString as X hiding (RawFilePath, getSearchPath)
|
||||
import System.FilePath.ByteString (getSearchPath)
|
||||
import qualified Data.ByteString as S
|
||||
#endif
|
||||
|
||||
|
@ -61,6 +68,10 @@ bytesFromOsPath = S.fromShort . getWindowsString . getOsString
|
|||
bytesFromOsPath = S.fromShort . getPosixString . getOsString
|
||||
#endif
|
||||
|
||||
{- For some reason not included in System.OsPath -}
|
||||
getSearchPath :: IO [OsPath]
|
||||
getSearchPath = map toOsPath <$> PB.getSearchPath
|
||||
|
||||
#else
|
||||
{- When not building with WITH_OSPATH, use RawFilePath.
|
||||
-}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue