Permalink
Browse files

Fixed problems with zipifyFilePath:

+ Don't ever put drive in zip file path!
+ Don't put leading "./" supplied by some versions of
  System.FilePath.splitDirectories.
  • Loading branch information...
1 parent a3d552c commit afb4e3b4e1092875818840efc046c863cb024dc4 @jgm committed Jan 30, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 Codec/Archive/Zip.hs
View
@@ -268,9 +268,10 @@ zipifyFilePath :: FilePath -> String
zipifyFilePath path =
let dir = takeDirectory path
fn = takeFileName path
- (drive, dir') = splitDrive dir
- dirParts = splitDirectories dir'
- in drive ++ (concat (map (++ "/") dirParts)) ++ fn
+ (_drive, dir') = splitDrive dir
+ -- note: some versions of filepath return ["."] if no dir
+ dirParts = dropWhile (==".") $ splitDirectories dir'
+ in (concat (map (++ "/") dirParts)) ++ fn
-- | Uncompress a lazy bytestring.
compressData :: CompressionMethod -> B.ByteString -> B.ByteString

0 comments on commit afb4e3b

Please sign in to comment.