@@ -7,6 +7,7 @@ import Data.Aeson
7
7
import Data.Yaml hiding (Parser )
8
8
import Control.Applicative ((<|>) )
9
9
import Data.List (isPrefixOf , isSuffixOf )
10
+ import System.FilePath ((</>) , dropFileName )
10
11
11
12
import qualified Data.ByteString.Lazy.Char8 as L8
12
13
@@ -34,15 +35,17 @@ decodeURLEither url
34
35
-- | If a stack.yaml file contains a @resolver@ that points to
35
36
-- a file, resolve that file and merge the snapshot into the
36
37
-- @Stack@ record.
37
- resolveSnapshot :: Stack -> IO Stack
38
- resolveSnapshot stack@ (Stack resolver compiler pkgs flags ghcOptions)
38
+ resolveSnapshot :: FilePath -> Stack -> IO Stack
39
+ resolveSnapshot stackYaml stack@ (Stack resolver compiler pkgs flags ghcOptions)
39
40
= if " .yaml" `isSuffixOf` resolver
40
41
then do evalue <- if (" http://" `isPrefixOf` resolver) || (" https://" `isPrefixOf` resolver)
41
42
then decodeURLEither resolver
42
- else decodeFileEither resolver
43
+ else decodeFileEither (srcDir </> resolver)
43
44
case evalue of
44
45
Left e -> error (show e)
45
46
Right (Snapshot resolver' compiler' _name pkgs' flags' ghcOptions') ->
46
47
pure $ Stack resolver' (compiler' <|> compiler) (pkgs <> pkgs') (flags <> flags')
47
48
(ghcOptions <> ghcOptions')
48
49
else pure stack
50
+ where
51
+ srcDir = dropFileName stackYaml
0 commit comments