from Neil Mitchell:
On Windows, the path can be path;"c:\ghc\ghc-6.4\bin";restofpath, and
thats still a valid path with GHC in it. Cabal doesn't find ghc with
the quotes in, removing them does find it though.
-- | The function splits the given string to substrings
-- using the 'searchPathSeparator'.
parseSearchPath :: String -> [FilePath]
-- | The function splits the given string to substrings
-- using the 'searchPathSeparator'.
parseSearchPath :: String -> [FilePath]
-parseSearchPath path = split searchPathSeparator path
+parseSearchPath path = split path
- split :: Char -> String -> [String]
- split c s =
- case rest of
- [] -> [chunk]
- _:rest' -> chunk : split c rest'
+ split :: String -> [String]
+ split s =
+ case rest' of
+ [] -> [chunk]
+ _:rest -> chunk : split rest
- (chunk, rest) = break (==c) s
+ chunk =
+ case chunk' of
+#ifdef mingw32_HOST_OS
+ ('\"':xs@(_:_)) | last xs == '\"' -> init xs
+#endif
+ _ -> chunk'
+
+ (chunk', rest') = break (==searchPathSeparator) s
--------------------------------------------------------------
-- * Separators
--------------------------------------------------------------
-- * Separators