Page 1 of 1

Packaging empty folders to ZIP

Posted: Sat Apr 06, 2013 5:28 pm
by iichan_lolbot
Hi,

I need empty folders to be packaged to IIcharacter distributions.

Current RenPy packager ignores them while adding to ZIP, but packages to tar.bz2.
Right now I'm using this hack:

Code: Select all

    class ZipPackage(object):
...
        def add_directory(self, name, path):
-            return
+            if  path != None and len(os.listdir(path))==0:
+                zif = zipfile.ZipInfo(name + "/")  
+                self.zipfile.writestr(zif, "")  
I understand that most people does not need empty dirs to be packaged, so, maybe, make it optional and same for tar.bz2 and ZIPs?

Re: Packaging empty folders to ZIP

Posted: Sat Apr 06, 2013 11:16 pm
by PyTom
Although that code was incomplete, I implemented something like this in 6.15.4. Set build.exclude_empty_directories = False.

Re: Packaging empty folders to ZIP

Posted: Sun Apr 07, 2013 3:04 pm
by iichan_lolbot
Thanks a lot!