{"action":"created","issue":{"url":"https://api.github.com/repos/nmoinvaz/minizip/issues/66","repository_url":"https://api.github.com/repos/nmoinvaz/minizip","labels_url":"https://api.github.com/repos/nmoinvaz/minizip/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/nmoinvaz/minizip/issues/66/comments","events_url":"https://api.github.com/repos/nmoinvaz/minizip/issues/66/events","html_url":"https://github.com/nmoinvaz/minizip/issues/66","id":172356305,"number":66,"title":"How to use minizip to compress a directory?","user":{"login":"dafanshu520","id":5927766,"avatar_url":"https://avatars.githubusercontent.com/u/5927766?v=3","gravatar_id":"","url":"https://api.github.com/users/dafanshu520","html_url":"https://github.com/dafanshu520","followers_url":"https://api.github.com/users/dafanshu520/followers","following_url":"https://api.github.com/users/dafanshu520/following{/other_user}","gists_url":"https://api.github.com/users/dafanshu520/gists{/gist_id}","starred_url":"https://api.github.com/users/dafanshu520/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dafanshu520/subscriptions","organizations_url":"https://api.github.com/users/dafanshu520/orgs","repos_url":"https://api.github.com/users/dafanshu520/repos","events_url":"https://api.github.com/users/dafanshu520/events{/privacy}","received_events_url":"https://api.github.com/users/dafanshu520/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-22T01:59:09Z","updated_at":"2016-08-29T04:25:18Z","closed_at":null,"body":"For example, I want to compress my test directory, which own test2 subdirectory and a.txt file, test2 own b.txt and c.txt, just as followings picture:\r\n![image](https://cloud.githubusercontent.com/assets/5927766/17841794/043ad1f0-684f-11e6-8d45-7932c34ae827.png)\r\n\r\nI found all of file in test diretory, there are /test/a.txt and /test/test2/b.txt and /test/test2/c.txt, and compress them one by one in test.zip file. But when I decompress the test.zip file, the test2 subdirectory is disappear,just as followings picture:\r\n![image](https://cloud.githubusercontent.com/assets/5927766/17841796/0e773f0a-684f-11e6-8481-dbc65f0a8f9f.png)\r\n\r\nWhere can I use the wrong? I used the code which as example in minizip,c:\r\n                            ...\r\n                            ...\r\n err = zipOpenNewFileInZip3(zf,filenameinzip,&zi,\r\n                                 NULL,0,NULL,0,NULL /* comment*/,\r\n                                 (opt_compress_level != 0) ? Z_DEFLATED : 0,\r\n                                 opt_compress_level,0,\r\n                                 /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */\r\n                                 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,\r\n                                 password,crcFile);\r\n\r\n                if (err != ZIP_OK)\r\n                    printf(\"error in opening %s in zipfile\\n\",filenameinzip);\r\n                else\r\n                {\r\n                    fin = fopen(filenameinzip,\"rb\");\r\n                    if (fin==NULL)\r\n                    {\r\n                        err=ZIP_ERRNO;\r\n                        printf(\"error in opening %s for reading\\n\",filenameinzip);\r\n                    }\r\n                }\r\n\r\n                if (err == ZIP_OK)\r\n                    do\r\n                    {\r\n                        err = ZIP_OK;\r\n                        size_read = (int)fread(buf,1,size_buf,fin);\r\n                        if (size_read < size_buf)\r\n                            if (feof(fin)==0)\r\n                        {\r\n                            printf(\"error in reading %s\\n\",filenameinzip);\r\n                            err = ZIP_ERRNO;\r\n                        }\r\n\r\n                        if (size_read>0)\r\n                        {\r\n                            err = zipWriteInFileInZip (zf,buf,size_read);\r\n                            if (err<0)\r\n                            {\r\n                                printf(\"error in writing %s in the zipfile\\n\",\r\n                                                 filenameinzip);\r\n                            }\r\n\r\n                        }\r\n                    } while ((err == ZIP_OK) && (size_read>0));\r\n                  ....\r\n                  .....\r\nI called the function three time to compress /test/a.txt , /test/test2/b.txt and /test/test2/c.txt, which pass to the parameter 'filenameinzip',it can work, but the subdirectory test2 is diappear.Please help me!!Thanks!"},"comment":{"url":"https://api.github.com/repos/nmoinvaz/minizip/issues/comments/243029507","html_url":"https://github.com/nmoinvaz/minizip/issues/66#issuecomment-243029507","issue_url":"https://api.github.com/repos/nmoinvaz/minizip/issues/66","id":243029507,"user":{"login":"nmoinvaz","id":1364432,"avatar_url":"https://avatars.githubusercontent.com/u/1364432?v=3","gravatar_id":"","url":"https://api.github.com/users/nmoinvaz","html_url":"https://github.com/nmoinvaz","followers_url":"https://api.github.com/users/nmoinvaz/followers","following_url":"https://api.github.com/users/nmoinvaz/following{/other_user}","gists_url":"https://api.github.com/users/nmoinvaz/gists{/gist_id}","starred_url":"https://api.github.com/users/nmoinvaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmoinvaz/subscriptions","organizations_url":"https://api.github.com/users/nmoinvaz/orgs","repos_url":"https://api.github.com/users/nmoinvaz/repos","events_url":"https://api.github.com/users/nmoinvaz/events{/privacy}","received_events_url":"https://api.github.com/users/nmoinvaz/received_events","type":"User","site_admin":false},"created_at":"2016-08-29T04:25:18Z","updated_at":"2016-08-29T04:25:18Z","body":"I don't see anywhere, where you are calling zipCloseFileInZip after each file."}}
{"actor":{"display_login":"nmoinvaz"}}