zip-archive 0.1.3.4 → 0.1.4
raw patch · 2 files changed
+7/−3 lines, 2 files
Files
- src/Codec/Archive/Zip.hs +6/−2
- zip-archive.cabal +1/−1
src/Codec/Archive/Zip.hs view
@@ -136,6 +136,7 @@ -- | Options for 'addFilesToArchive' and 'extractFilesFromArchive'. data ZipOption = OptRecursive -- ^ Recurse into directories when adding files | OptVerbose -- ^ Print information to stderr+ | OptDestination FilePath -- ^ Directory in which to extract deriving (Read, Show, Eq) -- | A zip archive with no contents.@@ -239,7 +240,9 @@ -- | Writes contents of an 'Entry' to a file. writeEntry :: [ZipOption] -> Entry -> IO () writeEntry opts entry = do- let path = eRelativePath entry+ let path = case [d | OptDestination d <- opts] of+ (x:_) -> x </> eRelativePath entry+ _ -> eRelativePath entry -- create directories if needed let dir = takeDirectory path exists <- doesDirectoryExist dir@@ -275,7 +278,8 @@ -- Note that the last-modified time is set correctly only in POSIX, -- not in Windows. extractFilesFromArchive :: [ZipOption] -> Archive -> IO ()-extractFilesFromArchive opts archive = mapM_ (writeEntry opts) $ zEntries archive+extractFilesFromArchive opts archive =+ mapM_ (writeEntry opts) $ zEntries archive -------------------------------------------------------------------------------- -- Internal functions for reading and writing zip binary format.
zip-archive.cabal view
@@ -1,5 +1,5 @@ Name: zip-archive-Version: 0.1.3.4+Version: 0.1.4 Cabal-Version: >= 1.10 Build-type: Simple Synopsis: Library for creating and modifying zip archives.