Thereafter a patch to manage special character the same way than for an url :
import Storage.URL( encString )
import Data.Char( isAlpha, isAscii, isDigit )
-- | Writes contents of an 'Entry' to a file.
writeEntry :: [ZipOption] -> Entry -> IO ()
writeEntry opts entry = do
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
unless exists $ do
createDirectoryIfMissing True dir
when (OptVerbose `elem` opts) $
hPutStrLn stderr $ " creating: " ++ dir
if length path > 0 && last path == '/' -- path is a directory
then return ()
else do
when (OptVerbose `elem` opts) $ do
hPutStrLn stderr $ case eCompressionMethod entry of
Deflate -> " inflating: " ++ path
NoCompression -> "extracting: " ++ path
+ #ifdef _WINDOWS
+ let encPath = (encString False (\x -> (isAscii x && isAlpha x) || isDigit x || (elem x "_-. /~")) path)
+ B.writeFile encPath (fromEntry entry)
+ #else
+ B.writeFile path (fromEntry entry)
+ #endif
-- Note that last modified times are supported only for POSIX, not for
-- Windows.
setFileTimeStamp path (eLastModified entry)
Thereafter a patch to manage special character the same way than for an url :