11-- Note: we should only depend on libraries that ship with GHC for this. No
22-- external dependencies!
33import Control.Monad (when )
4+ import Data.List (concat , isPrefixOf )
45import Data.Version (Version , parseVersion )
56import Prelude (Bool (.. ), FilePath , elem , error ,
67 filter , fmap , getLine , lines ,
@@ -14,7 +15,7 @@ import System.Directory (doesFileExist,
1415import System.Environment (getArgs , getExecutablePath )
1516import System.Exit (ExitCode (ExitSuccess ))
1617import System.FilePath (splitExtension , takeDirectory ,
17- takeExtension , (</>) )
18+ takeExtension , takeFileName , (</>) )
1819import System.IO (IO , hFlush , stdout )
1920import System.Process (rawSystem , readProcess )
2021import Text.ParserCombinators.ReadP (readP_to_S )
@@ -58,11 +59,11 @@ un7z destPath sevenz =
5859 go fp = when (ext `elem` exts) $ do
5960 putStrLn $ " Decompressing " ++ fp ++ " to " ++ destPath
6061 ec <- rawSystem sevenz
61- [ " x"
62- , " -o" ++ destPath
63- , " -y"
64- , fp
65- ]
62+ ( concat [ [ " x"
63+ , " -o" ++ destPath
64+ , " -y"
65+ , fp ]
66+ , [ " stack.exe " | " stack- " `isPrefixOf` (takeFileName fp) ]])
6667 removeFile fp
6768 when (ec /= ExitSuccess )
6869 $ error $ " Could not decompress: " ++ fp
0 commit comments