Packaging empty folders to ZIP

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
iichan_lolbot
Veteran
Posts: 206
Joined: Tue Dec 30, 2008 9:18 am
Projects: iichan erogame
Contact:

Packaging empty folders to ZIP

#1 Post 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?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Packaging empty folders to ZIP

#2 Post by PyTom »

Although that code was incomplete, I implemented something like this in 6.15.4. Set build.exclude_empty_directories = False.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

iichan_lolbot
Veteran
Posts: 206
Joined: Tue Dec 30, 2008 9:18 am
Projects: iichan erogame
Contact:

Re: Packaging empty folders to ZIP

#3 Post by iichan_lolbot »

Thanks a lot!

Post Reply

Who is online

Users browsing this forum: No registered users