developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
Opened 13 years ago
Closed 13 years ago
#570 closed bug (fixed)
jZipCreator : empty dirs are not included in the archive
Reported by: | Julien | Owned by: | Julien |
---|---|---|---|
Priority: | normal | Milestone: | Jelix 1.0.4 |
Component: | jelix:utils | Version: | 1.0.3 |
Severity: | minor | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Documentation needed: | no | |
Hosting Provider: | Php version: |
Description
When we add directories in an archive using jZipCreator, empty dirs (ie without files inside) are not added.
I will add a new public method called addEmptyDir($name) wich will allow to add an empty dir.
The existing addDir() method will also be fixed (will call addEmptyDir() when needed) to include empty dirs.
Attachments (2)
Change History (11)
comment:1 Changed 13 years ago by Julien
- Owner set to Julien
- Status changed from new to assigned
comment:2 Changed 13 years ago by laurentj
- Milestone set to Jelix 1.0.4
- Severity changed from normal to minor
Changed 13 years ago by Julien
comment:3 Changed 13 years ago by Julien
- review set to review?
There's a new public method called addEmptyDir(). It uses quite the same code used for file addition, but external attributes are set to 16 instead of 32.
I found this value from some threads about zip files usage in python.
It seems that we can also use 48 instead of 16, but I don't see any difference.
comment:4 Changed 13 years ago by laurentj
- review changed from review? to review+
Ok, it seems ok to me, although you could do factorization between addContentFile and addEmptyDir, since most of their line codes are same.
Don't forget to update CREDITS files.
Apply your patch on the 1.0.x branch and on the trunk.
Thanks for this patch :-)
comment:5 Changed 13 years ago by Julien
Ok I'll try refactoring the code before applying the patch.
comment:6 Changed 13 years ago by Julien
I improved the patch. Works like the old one, but the code is cleaner and there are some improvements inside.
Also fixed a bug when adding emptydirs, dirs (recursive) and virtual files at the same time.
working action code :
function zip(){ $rep = $this->getResponse('zip'); $rep->zipFilename = 'myCrazyPackage.zip'; $rep->content->addContentFile('dynamic.txt', 'contenu généré comme on veut'); $rep->content->addDir(dirname(__FILE__).'/../','',true); $rep->content->addEmptyDir('tata'); return $rep; }
Laurent, Ok for the commit, or would you like to test it again ?
comment:7 Changed 13 years ago by Julien
- review changed from review+ to review?
comment:9 Changed 13 years ago by Julien
- Resolution set to fixed
- Status changed from assigned to closed
commited
patch with empty dirs support