Skip to content

Commit

Permalink
Fix creating empty directory in zipfile
Browse files Browse the repository at this point in the history
I'm using a different technique to do that, based on this mailing list answer: https://mail.python.org/pipermail/python-list/2003-June/205859.html
  • Loading branch information
Ghostkeeper committed Nov 13, 2017
1 parent 1ccb796 commit 5ff1dcf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion create_plugin.py
Expand Up @@ -44,6 +44,7 @@ def zipDirectory(path, zip_handle):
plugin_file_location = plugin_name + ".umplugin"
with zipfile.ZipFile(plugin_file_location, "w") as plugin_zip:
# Ensure that the root folder is created correctly. We need to tell zip to not compress the folder!
plugin_zip.write(plugin_file_location, arcname = plugin_name, compress_type = zipfile.ZIP_STORED)
subdirectory = zipfile.ZipInfo(plugin_name + "/")
plugin_zip.writestr(subdirectory, "", compress_type = zipfile.ZIP_STORED) #Writing an empty string creates the directory.
zipDirectory(full_plugin_path, plugin_zip)
print("Done!")

0 comments on commit 5ff1dcf

Please sign in to comment.