Skip to content

Commit

Permalink
FilePath -> Path in most of fetchPackages'
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaisorblade committed Jul 19, 2016
1 parent 738a72f commit 1f534a7
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/Stack/Fetch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ import Prelude -- Fix AMP warning
import Stack.GhcPkg
import Stack.PackageIndex
import Stack.Types
import qualified System.Directory as D
import System.FilePath ((<.>))
import qualified System.FilePath as FP
import System.IO (IOMode (ReadMode),
Expand Down Expand Up @@ -499,12 +498,11 @@ fetchPackages' mdistDir toFetchAll = do
let progressSink _ =
liftIO $ runInBase $ $logInfo $ packageIdentifierText ident <> ": download"
_ <- verifiedDownload downloadReq destpath progressSink
let identStr = packageIdentifierString ident
identStrP <- parseRelDir identStr

identStrP <- parseRelDir $ packageIdentifierString ident

F.forM_ (tfDestDir toFetch) $ \destDir -> do
let dest = toFilePath $ parent destDir
innerDest = toFilePath destDir
let innerDest = toFilePath destDir

unexpectedEntries <- liftIO $ untar destpath identStrP (parent destDir)

Expand All @@ -513,18 +511,18 @@ fetchPackages' mdistDir toFetchAll = do
Nothing -> return ()
-- See: https://github.com/fpco/stack/issues/157
Just distDir -> do
let inner = dest FP.</> identStr
oldDist = inner FP.</> "dist"
newDist = inner FP.</> toFilePath distDir
exists <- D.doesDirectoryExist oldDist
let inner = parent destDir </> identStrP
oldDist = inner </> $(mkRelDir "dist")
newDist = inner </> distDir
exists <- doesDirExist oldDist
when exists $ do
-- Previously used takeDirectory, but that got confused
-- by trailing slashes, see:
-- https://github.com/commercialhaskell/stack/issues/216
--
-- Instead, use Path which is a bit more resilient
ensureDir . parent =<< parseAbsDir newDist
D.renameDirectory oldDist newDist
ensureDir $ parent newDist
renameDir oldDist newDist

let cabalFP =
innerDest FP.</>
Expand Down

0 comments on commit 1f534a7

Please sign in to comment.