Keep pgm paths in native format
%* *
%************************************************************************
%* *
%************************************************************************
-All these pathnames are maintained in Unix format.
+All these pathnames are maintained IN THE NATIVE FORMAT OF THE HOST MACHINE.
(See remarks under pathnames below)
\begin{code}
(See remarks under pathnames below)
\begin{code}
-- top_dir
-- for "installed" this is the root of GHC's support files
-- for "in-place" it is the root of the build tree
-- top_dir
-- for "installed" this is the root of GHC's support files
-- for "in-place" it is the root of the build tree
+ -- NB: top_dir is assumed to be in standard Unix format '/' separated
- ; let installed_bin pgm = top_dir `slash` "bin" `slash` pgm
- installed file = top_dir `slash` file
- inplace dir pgm = top_dir `slash` dir `slash` pgm
+ ; let installed_bin pgm = pgmPath (top_dir `slash` "bin") pgm
+ installed file = pgmPath top_dir file
+ inplace dir pgm = pgmPath (top_dir `slash` dir) pgm
; let pkgconfig_path
| am_installed = installed "package.conf"
; let pkgconfig_path
| am_installed = installed "package.conf"
getTopDir :: [String]
-> IO (Bool, -- True <=> am installed, False <=> in-place
getTopDir :: [String]
-> IO (Bool, -- True <=> am installed, False <=> in-place
+ String) -- TopDir (in Unix format '/' separated)
getTopDir minusbs
= do { top_dir1 <- get_proto
getTopDir minusbs
= do { top_dir1 <- get_proto
-> String -- Command name (possibly a full path)
-- assumed already dos-ified
-> [String] -- Arguments
-> String -- Command name (possibly a full path)
-- assumed already dos-ified
-> [String] -- Arguments
- -- runSomthing will dos-ify them
+ -- runSomething will dos-ify them
-> IO ()
runSomething phase_name pgm args
-> IO ()
runSomething phase_name pgm args
- cmd_line = unwords (dosifyPaths (pgm : args))
+ cmd_line = unwords (pgm : dosifyPaths args)
+ -- The pgm is already in native format
traceCmd :: String -> String -> IO () -> IO ()
-- a) trace the command (at two levels of verbosity)
traceCmd :: String -> String -> IO () -> IO ()
-- a) trace the command (at two levels of verbosity)
unDosifyPath :: String -> String
-- Just change '\' to '/'
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_TARGET_OS)
--------------------- Windows version ------------------
#if defined(mingw32_TARGET_OS)
--------------------- Windows version ------------------
dosifyPaths xs = map dosifyPath xs
dosifyPaths xs = map dosifyPath xs
+pgmPath dir pgm = dosifyPath dir ++ '\\' : pgm
+
dosifyPath stuff
= subst '/' '\\' real_stuff
where
dosifyPath stuff
= subst '/' '\\' real_stuff
where
--------------------- Unix version ---------------------
dosifyPaths ps = ps
unDosifyPath xs = subst '\\' '/' xs
--------------------- Unix version ---------------------
dosifyPaths ps = ps
unDosifyPath xs = subst '\\' '/' xs
+pgmPath dir pgm = dir ++ '/' : pgm
--------------------------------------------------------
#endif
--------------------------------------------------------
#endif