mrkkrp / zip

Efficient library for manipulating zip archives
Other
81 stars 27 forks source link

Changed saveEntry & unpackInto to optionally restore modification time #26

Closed jchia closed 6 years ago

jchia commented 7 years ago

25

Test passes on my machine with latest path-io.

mrkkrp commented 7 years ago

Please bump path-io version in Cabal file and add

extra-deps:
- path-io-1.2.2

To stack.yaml in this PR as well.

mrkkrp commented 7 years ago

Next Travis build should start to pass after these changes, path-io-1.2.2 is already on Hackage.

jchia commented 7 years ago

It turns out that Path.IO.setModificationTime requires MIN_VERSION_directory(1,2,3), so saveEntry won't compile with an older directory package.

One option is to make path-io-1.2.3 require directory >= 1.2.3 and make zip require path-io >= 1.2.3.

mrkkrp commented 7 years ago

Indeed, but this way we also will lose compatibility with older GHCs, because directory versions correspond to GHC versions.

mrkkrp commented 7 years ago

So unfortunatelly it looks like I can't really merge this till 7.8 and 7.10 became so old that we don't need to support them.

If you need this for your personal usage, I think you know now how to make it work in your projects.

jchia commented 7 years ago

It's unfortunate that directory package for ghc 7.10 doesn't support setting modification time. Silently not restoring the modification time when setModificationTime is unavailable is not a good solution, either.

I took a quick glance at the code for System.Directory.setModificationTime and it looks quite a multi-platform ball of noodles, though I haven't investigated why that code wouldn't work under ghc 7.10.

mrkkrp commented 7 years ago

There are a number of packages, directory included, that are frozen for every GHC release. So when you compile with certain GHC version, you're bound to use particular directory version that corresponds to it. Since we know that older directory (before 1.2.3.0) doesn't support setModificationTime, we can't support older GHC because of this.