Changed to use IO Exceptions
This commit is contained in:
parent
5d43168370
commit
3fd9fae66a
@ -888,17 +888,18 @@ applyPatches :: (MonadReader env m, HasDirs env, HasLog env, MonadIO m)
|
||||
-> FilePath -- ^ dir to apply patches in
|
||||
-> Excepts '[PatchFailed] m ()
|
||||
applyPatches pdir ddir = do
|
||||
seriesExists <- liftIO (doesFileExist (pdir </> "series"))
|
||||
patches <- if seriesExists
|
||||
then
|
||||
liftIO $ map (pdir </>) . lines <$> readFile (pdir </> "series")
|
||||
else
|
||||
(fmap . fmap) (pdir </>) $ liftIO $ sort <$> findFiles
|
||||
let lexicographical = (fmap . fmap) (pdir </>) $ sort <$> findFiles
|
||||
pdir
|
||||
(makeRegexOpts compExtended
|
||||
execBlank
|
||||
([s|.+\.(patch|diff)$|] :: ByteString)
|
||||
)
|
||||
let quilt = map (pdir </>) . lines <$> readFile (pdir </> "series")
|
||||
|
||||
patches <- liftIO $ quilt `catchIO` (\e ->
|
||||
if isDoesNotExistError e || isPermissionError e then
|
||||
lexicographical
|
||||
else throwIO e)
|
||||
forM_ patches $ \patch' -> applyPatch patch' ddir
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user