-
-%************************************************************************
-%* *
-\subsection{Path names}
-%* *
-%************************************************************************
-
-We maintain path names in Unix form ('/'-separated) right until
-the last moment. On Windows we dos-ify them just before passing them
-to the Windows command.
-
-The alternative, of using '/' consistently on Unix and '\' on Windows,
-proved quite awkward. There were a lot more calls to dosifyPath,
-and even on Windows we might invoke a unix-like utility (eg 'sh'), which
-interpreted a command line 'foo\baz' as 'foobaz'.
-
-\begin{code}
------------------------------------------------------------------------------
--- Convert filepath into MSDOS form.
-
-dosifyPaths :: [String] -> [String]
--- dosifyPaths does two things
--- a) change '/' to '\'
--- b) remove initial '/cygdrive/'
-
-unDosifyPath :: String -> String
--- Just change '\' to '/'
-
-pgmPath :: String -- Directory string in Unix format
- -> String -- Program name with no directory separators
- -- (e.g. copy /y)
- -> String -- Program invocation string in native format
-
-
-
-#if defined(mingw32_HOST_OS)
-
---------------------- Windows version ------------------
-dosifyPaths xs = map dosifyPath xs
-
-unDosifyPath xs = subst '\\' '/' xs
-
-pgmPath dir pgm = dosifyPath dir ++ '\\' : pgm
-
-dosifyPath stuff
- = subst '/' '\\' real_stuff
- where
- -- fully convince myself that /cygdrive/ prefixes cannot
- -- really appear here.
- cygdrive_prefix = "/cygdrive/"
-
- real_stuff
- | cygdrive_prefix `isPrefixOf` stuff = dropList cygdrive_prefix stuff
- | otherwise = stuff
-
-#else
-
---------------------- Unix version ---------------------
-dosifyPaths ps = ps
-unDosifyPath xs = xs
-pgmPath dir pgm = dir ++ '/' : pgm
-dosifyPath stuff = stuff
---------------------------------------------------------
-#endif
-
-subst a b ls = map (\ x -> if x == a then b else x) ls
-\end{code}
-
-
------------------------------------------------------------------------------
- Path name construction
-
-\begin{code}
-slash :: String -> String -> String
-absPath, relPath :: [String] -> String
-
-relPath [] = ""
-relPath xs = foldr1 slash xs
-
-absPath xs = "" `slash` relPath xs
-
-slash s1 s2 = s1 ++ ('/' : s2)
-\end{code}
-
-