packages feed

zip-archive 0.2 → 0.2.1

raw patch · 2 files changed

+7/−3 lines, 2 files

Files

src/Codec/Archive/Zip.hs view
@@ -142,6 +142,7 @@ data ZipOption = OptRecursive               -- ^ Recurse into directories when adding files                | OptVerbose                 -- ^ Print information to stderr                | OptDestination FilePath    -- ^ Directory in which to extract+               | OptLocation FilePath Bool  -- ^ Where to place file when adding files and whether to append current path                deriving (Read, Show, Eq)  -- | A zip archive with no contents.@@ -221,8 +222,11 @@ readEntry :: [ZipOption] -> FilePath -> IO Entry readEntry opts path = do   isDir <- doesDirectoryExist path-  let path' = zipifyFilePath $ normalise $-              path ++ if isDir then "/" else ""  -- make sure directories end with /+  -- make sure directories end in / and deal with the OptLocation option+  let path' = let p = zipifyFilePath $ normalise $ path ++ if isDir then "/" else "" in+              (case [(l,a) | OptLocation l a <- opts] of+                    ((l,a):_) -> if a then l </> p else l+                    _         -> p)   contents <- if isDir                  then return B.empty                  else B.readFile path
zip-archive.cabal view
@@ -1,5 +1,5 @@ Name:                zip-archive-Version:             0.2+Version:             0.2.1 Cabal-Version:       >= 1.10 Build-type:          Simple Synopsis:            Library for creating and modifying zip archives.