Skip to content

Commit

Permalink
Fix TH dependent file detection for absolute paths and special charac…
Browse files Browse the repository at this point in the history
…ters (#105)
  • Loading branch information
borsboom committed Aug 8, 2015
1 parent f976929 commit 8b82837
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Stack/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -769,21 +769,24 @@ resolveFilesAndDeps ty buildComponentDir dirs names0 exts = do
thDeps =
case ty of
AllFiles ->
-- The dependent file path is surrounded by quotes but is not escaped.
-- It can be an absolute or relative path.
mapMaybe
(fmap (dir </>) .
parseRelFile .
T.unpack .
decodeUtf8 .
C8.takeWhile (/= '"') .
C8.dropWhile (== '"') . C8.dropWhile (/= '"')) $
(parseAbsOrRelFile dir <=<
(fmap T.unpack .
(T.stripSuffix "\"" <=< T.stripPrefix "\"") .
decodeUtf8 . C8.dropWhile (/= '"'))) $
filter ("addDependentFile \"" `C8.isPrefixOf`) dumpHI
Modules -> []
--liftIO $ putStrLn $ "XXX dumpHI " ++ show dumpHIPath ++ "\n XXX moduleDeps=" ++ show moduleDeps ++ "\n XXX thDeps=" ++ show thDeps
return
(moduleDeps, thDeps)
return (moduleDeps, thDeps)
getHIDir = do
bld <- asks snd
return $ maybe bld (bld </>) buildComponentDir
parseAbsOrRelFile dir fp =
case parseRelFile fp of
Just rel -> Just (dir </> rel)
Nothing -> parseAbsFile fp

-- | Try to resolve the list of base names in the given directory by
-- looking for unique instances of base names applied with the given
Expand Down

0 comments on commit 8b82837

Please sign in to comment.