From 6d28a48ac1c864d69038b3d40274be309be862d4 Mon Sep 17 00:00:00 2001 From: krasimir Date: Thu, 20 Oct 2005 17:12:28 +0000 Subject: [PATCH] [project @ 2005-10-20 17:12:28 by krasimir] 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. --- System/Directory/Internals.hs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/System/Directory/Internals.hs b/System/Directory/Internals.hs index 761b771..c763764 100644 --- a/System/Directory/Internals.hs +++ b/System/Directory/Internals.hs @@ -124,15 +124,22 @@ pathParents p = -- | The function splits the given string to substrings -- using the 'searchPathSeparator'. parseSearchPath :: String -> [FilePath] -parseSearchPath path = split searchPathSeparator path +parseSearchPath path = split path where - 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 where - (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 -- 1.7.10.4