File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module Path.Extra
77 ,dropRoot
88 ,parseCollapsedAbsDir
99 ,parseCollapsedAbsFile
10+ ,concatAndColapseAbsDir
1011 ,rejectMissingFile
1112 ,rejectMissingDir
1213 ,pathToByteString
@@ -43,6 +44,12 @@ parseCollapsedAbsDir = parseAbsDir . collapseFilePath
4344parseCollapsedAbsFile :: MonadThrow m => FilePath -> m (Path Abs File )
4445parseCollapsedAbsFile = parseAbsFile . collapseFilePath
4546
47+ -- | Combine a 'Path Abs Dir' and a relative 'FilePath' into a 'Path Abs Dir'
48+ -- We can't parse the FilePath first because we need to account for ".."
49+ -- in the FilePath (#2895)
50+ concatAndColapseAbsDir :: MonadThrow m => Path Abs Dir -> FilePath -> m (Path Abs Dir )
51+ concatAndColapseAbsDir base rel = parseCollapsedAbsDir (toFilePath base FP. </> rel)
52+
4653-- | Collapse intermediate "." and ".." directories from a path.
4754--
4855-- > collapseFilePath "./foo" == "foo"
Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ generateBuildInfoOpts BioInput {..} =
420420 | Just makeGenDir <- [fileGenDirFromComponentName biComponentName]]) ++
421421 [" -stubdir=" ++ toFilePathNoTrailingSep (buildDir biDistDir)]
422422 toIncludeDir " ." = Just biCabalDir
423- toIncludeDir x = fmap ( biCabalDir </> ) (parseRelDir x)
423+ toIncludeDir relDir = concatAndColapseAbsDir biCabalDir relDir
424424 includeOpts =
425425 map (" -I" <> ) (configExtraIncludeDirs <> pkgIncludeOpts)
426426 configExtraIncludeDirs =
You can’t perform that action at this time.
0 commit comments