|
1 |
| -{-# LANGUAGE QuasiQuotes #-} |
2 |
| -{-# LANGUAGE ViewPatterns #-} |
| 1 | +{-# LANGUAGE PackageImports #-} |
3 | 2 |
|
4 | 3 | -----------------------------------------------------------------------------
|
5 | 4 | -- |
|
@@ -85,6 +84,17 @@ import GHC.IO.Exception (IOException(..), IOErrorType(OtherError))
|
85 | 84 | import Prelude hiding (break, length, tail)
|
86 | 85 | import qualified Prelude as P
|
87 | 86 |
|
| 87 | +#if !MIN_VERSION_filepath(1,5,0) |
| 88 | +import Data.Coerce |
| 89 | +import qualified "filepath" System.OsPath.Data.ByteString.Short.Word16 as BC |
| 90 | + |
| 91 | +tail :: WindowsString -> WindowsString |
| 92 | +tail = coerce BC.tail |
| 93 | + |
| 94 | +break :: (WindowsChar -> Bool) -> WindowsString -> (WindowsString, WindowsString) |
| 95 | +break = coerce BC.break |
| 96 | +#endif |
| 97 | + |
88 | 98 |
|
89 | 99 | -- | This function can be used to parse command line arguments and return
|
90 | 100 | -- the split up arguments as elements in a list.
|
@@ -142,7 +152,8 @@ getEnvironment = bracket c_GetEnvironmentStringsW c_FreeEnvironmentStrings $ \lp
|
142 | 152 | divvy :: WindowsString -> (WindowsString, WindowsString)
|
143 | 153 | divvy str =
|
144 | 154 | case break (== unsafeFromChar '=') str of
|
145 |
| - (xs,[pstr||]) -> (xs,[pstr||]) -- don't barf (like Posix.getEnvironment) |
| 155 | + (xs,ys) |
| 156 | + | ys == mempty -> (xs,ys) -- don't barf (like Posix.getEnvironment) |
146 | 157 | (name, ys) -> let value = tail ys in (name,value)
|
147 | 158 |
|
148 | 159 | builder :: LPWSTR -> IO [WindowsString]
|
|
0 commit comments