From 94bed88600bbebc36997e0abe327bd0dec86bdca Mon Sep 17 00:00:00 2001 From: ijones <ijones@syntaxpolice.org> Date: Tue, 19 Jul 2005 06:22:08 +0000 Subject: [PATCH] ross paterson: simplify consruction of pkg tool name --- Distribution/Simple/Configure.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Distribution/Simple/Configure.hs b/Distribution/Simple/Configure.hs index cc4b94b5b9..ed57678ad7 100644 --- a/Distribution/Simple/Configure.hs +++ b/Distribution/Simple/Configure.hs @@ -83,7 +83,8 @@ import Data.List (intersperse, nub, maximumBy, isPrefixOf) import Data.Char (isSpace) import Data.Maybe(fromMaybe) import System.Directory -import Distribution.Compat.FilePath (splitFileName, joinFileName) +import Distribution.Compat.FilePath (splitFileName, joinFileName, + joinFileExt, exeExtension) import System.Cmd ( system ) import System.Exit ( ExitCode(..) ) import Control.Monad ( when, unless ) @@ -345,8 +346,8 @@ pCheck rs = [ r | (r,s) <- rs, all isSpace s ] guessPkgToolFromHCPath :: Int -> CompilerFlavor -> FilePath -> IO FilePath guessPkgToolFromHCPath verbose flavor path = do let pkgToolName = compilerPkgToolName flavor - (dir,name) = splitFileName path - pkgtool = dir `joinFileName` pkgToolName ++ drop (length (compilerBinaryName flavor)) name + (dir,_) = splitFileName path + pkgtool = dir `joinFileName` pkgToolName `joinFileExt` exeExtension when (verbose > 0) $ message $ "looking for package tool: " ++ pkgToolName ++ " near compiler in " ++ path exists <- doesFileExist pkgtool when (not exists) $ -- GitLab