Commit dffb2a27 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Add programPath :: Program -> FilePath

At the moment it's a partial function, but we should change that by having
a distinction between an abstract program and a configured program.
parent f50fe5c9
......@@ -32,6 +32,7 @@ module Distribution.Program(
, withProgramFlag
, programOptsFlag
, programOptsField
, programPath
, defaultProgramConfiguration
, updateProgram
, maybeUpdateProgram
......@@ -147,6 +148,17 @@ programOptsFlag Program{programName=n} = n ++ "-options"
programOptsField :: Program -> String
programOptsField = programOptsFlag
-- |The full path of a configured program.
--
-- * This is a partial function, it is not defined for programs with an
-- EmptyLocation.
programPath :: Program -> FilePath
programPath program =
case programLocation program of
UserSpecified p -> p
FoundOnSystem p -> p
EmptyLocation -> error "programPath EmptyLocation"
-- ------------------------------------------------------------
-- * cabal programs
-- ------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment