add Data.Sequence to nhc98 build
[haskell-directory.git] / System / Directory / Internals.hs
index 7c7f8a5..c763764 100644 (file)
@@ -91,7 +91,7 @@ pathParents :: FilePath -> [FilePath]
 pathParents p =
     root'' : map ((++) root') (dropEmptyPath $ inits path')
     where
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
        (root,path) = case break (== ':') p of
           (path,    "") -> ("",path)
           (root,_:path) -> (root++":",path)
@@ -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
@@ -150,7 +157,7 @@ isPathSeparator ch = ch == pathSeparator || ch == '/'
 -- separator is a slash (@\"\/\"@) on Unix and Macintosh, and a backslash
 -- (@\"\\\"@) on the Windows operating system.
 pathSeparator :: Char
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
 pathSeparator = '\\'
 #else
 pathSeparator = '/'
@@ -161,7 +168,7 @@ pathSeparator = '/'
 -- environment variables. The separator is a colon (@\":\"@) on Unix and
 -- Macintosh, and a semicolon (@\";\"@) on the Windows operating system.
 searchPathSeparator :: Char
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
 searchPathSeparator = ';'
 #else
 searchPathSeparator = ':'
@@ -171,7 +178,7 @@ searchPathSeparator = ':'
 -- | Extension for executable files
 -- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2)
 exeExtension :: String
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
 exeExtension = "exe"
 #else
 exeExtension = ""