git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1674 from freiric/master
8b60d43John MacFarlane
src/Text/Pandoc/Shared.hs+4−6
@@ -735,12 +735,10 @@ renderTags' = renderTagsOptions
735
735
736-- | Perform an IO action in a directory, returning to starting directory.
736-- | Perform an IO action in a directory, returning to starting directory.
737inDirectory :: FilePath -> IO a -> IO a
737inDirectory :: FilePath -> IO a -> IO a
738−inDirectory path action = do
738+inDirectory path action = E.bracket
739− oldDir <- getCurrentDirectory
739+ getCurrentDirectory
740− setCurrentDirectory path
740+ setCurrentDirectory
741− result <- action
742− setCurrentDirectory oldDir
741+ (const $ setCurrentDirectory path >> action)
743− return result
744
742
745readDefaultDataFile :: FilePath -> IO BS.ByteString
743readDefaultDataFile :: FilePath -> IO BS.ByteString
746readDefaultDataFile fname =
744readDefaultDataFile fname =