ZIP file created with SharpZipLib cannot be opened on Mac OS X

前端 未结 10 1347
有刺的猬
有刺的猬 2021-02-04 08:31

Argh, today is the day of stupid problems and me being an idiot.

I have an application which creates a zip file containing some JPEGs from a certain directory. I use th

10条回答
  •  无人共我
    2021-02-04 09:22

    I had exactly the same problem, my mistake was (and in your example code as well) that I didn't supply the file lenght for each entry.

    Example code:

     ...
     ZipEntry entry = new ZipEntry(Path.GetFileName(pathname));
     entry.DateTime = now;
     var fileInfo = new FileInfo(pathname)
     entry.size  = fileInfo.lenght;
     ...
    

提交回复
热议问题