Merge pull request #1674 from freiric/master
fix inDirectory to reset to the original directory in case an exception ...
This commit is contained in:
commit
8b60d430f2
1 changed files with 4 additions and 6 deletions
|
@ -735,12 +735,10 @@ renderTags' = renderTagsOptions
|
|||
|
||||
-- | Perform an IO action in a directory, returning to starting directory.
|
||||
inDirectory :: FilePath -> IO a -> IO a
|
||||
inDirectory path action = do
|
||||
oldDir <- getCurrentDirectory
|
||||
setCurrentDirectory path
|
||||
result <- action
|
||||
setCurrentDirectory oldDir
|
||||
return result
|
||||
inDirectory path action = E.bracket
|
||||
getCurrentDirectory
|
||||
setCurrentDirectory
|
||||
(const $ setCurrentDirectory path >> action)
|
||||
|
||||
readDefaultDataFile :: FilePath -> IO BS.ByteString
|
||||
readDefaultDataFile fname =
|
||||
|
|
Loading…
Add table
Reference in a new issue