icsharpcode / SharpZipLib

#ziplib is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.
http://icsharpcode.github.io/SharpZipLib/
MIT License
3.73k stars 976 forks source link

how to retain empty directory just for make the tree complete #798

Closed liugt34 closed 2 years ago

liugt34 commented 2 years ago

Steps to reproduce

  1. have 3 directories, and one directory has no file
  2. zip the root directory
  3. the empty directory missing

            var zipName = Path.ChangeExtension(versionPath, ".zip");
            FastZip fastZip = new FastZip();
            fastZip.UseUnicode = true;
            fastZip.StringCodec.CodePage = Encoding.GetEncoding("GB2312").CodePage;
            string filter = null;
            fastZip.CreateZip(zipName, versionPath, true, filter, filter);

image image

Expected behavior

retain the directory even if the directory is empty

Actual behavior

the directory has missing

Version of SharpZipLib

1.4.0

Obtained from (only keep the relevant lines)

liugt34 commented 2 years ago

i find this property CreateEmptyDirectories