Skip to content
Snippets Groups Projects
Commit 94bed886 authored by Isaac Potoczny-Jones's avatar Isaac Potoczny-Jones
Browse files

ross paterson: simplify consruction of pkg tool name

parent 16ba3527
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,8 @@ import Data.List (intersperse, nub, maximumBy, isPrefixOf) ...@@ -83,7 +83,8 @@ import Data.List (intersperse, nub, maximumBy, isPrefixOf)
import Data.Char (isSpace) import Data.Char (isSpace)
import Data.Maybe(fromMaybe) import Data.Maybe(fromMaybe)
import System.Directory import System.Directory
import Distribution.Compat.FilePath (splitFileName, joinFileName) import Distribution.Compat.FilePath (splitFileName, joinFileName,
joinFileExt, exeExtension)
import System.Cmd ( system ) import System.Cmd ( system )
import System.Exit ( ExitCode(..) ) import System.Exit ( ExitCode(..) )
import Control.Monad ( when, unless ) import Control.Monad ( when, unless )
...@@ -345,8 +346,8 @@ pCheck rs = [ r | (r,s) <- rs, all isSpace s ] ...@@ -345,8 +346,8 @@ pCheck rs = [ r | (r,s) <- rs, all isSpace s ]
guessPkgToolFromHCPath :: Int -> CompilerFlavor -> FilePath -> IO FilePath guessPkgToolFromHCPath :: Int -> CompilerFlavor -> FilePath -> IO FilePath
guessPkgToolFromHCPath verbose flavor path guessPkgToolFromHCPath verbose flavor path
= do let pkgToolName = compilerPkgToolName flavor = do let pkgToolName = compilerPkgToolName flavor
(dir,name) = splitFileName path (dir,_) = splitFileName path
pkgtool = dir `joinFileName` pkgToolName ++ drop (length (compilerBinaryName flavor)) name pkgtool = dir `joinFileName` pkgToolName `joinFileExt` exeExtension
when (verbose > 0) $ message $ "looking for package tool: " ++ pkgToolName ++ " near compiler in " ++ path when (verbose > 0) $ message $ "looking for package tool: " ++ pkgToolName ++ " near compiler in " ++ path
exists <- doesFileExist pkgtool exists <- doesFileExist pkgtool
when (not exists) $ when (not exists) $
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment