more OsPath conversion (572/749)

Sponsored-by: Jack Hill
This commit is contained in:
Joey Hess 2025-02-06 16:18:52 -04:00
parent cb2c069ad1
commit 2d1db7986c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
18 changed files with 99 additions and 96 deletions

View file

@ -15,11 +15,12 @@ module Utility.OsPath (
OsString,
RawFilePath,
literalOsPath,
stringToOsPath,
toOsPath,
fromOsPath,
module X,
getSearchPath,
unsafeFromChar
unsafeFromChar,
) where
import Utility.FileSystemEncoding
@ -101,7 +102,9 @@ bytesFromOsPath = getPosixString . getOsString
getSearchPath :: IO [OsPath]
getSearchPath = map toOsPath <$> PB.getSearchPath
{- Used for string constants. -}
{- Used for string constants. Note that when using OverloadedStrings,
- the IsString instance for ShortByteString only works properly with
- ASCII characters. -}
literalOsPath :: ShortByteString -> OsPath
literalOsPath = toOsPath
@ -130,3 +133,6 @@ unsafeFromChar = fromIntegral . ord
literalOsPath :: RawFilePath -> OsPath
literalOsPath = id
#endif
stringToOsPath :: String -> OsPath
stringToOsPath = toOsPath