[filesystem] exclude '__MACOSX' metadata dir contained in zip file

This commit is contained in:
Cosimo Lupo 2017-07-21 17:43:00 +01:00
parent 879fce2e7c
commit f1f4e120f5

View File

@ -74,7 +74,11 @@ class FileSystem(object):
raise UFOLibError("The fs module is required for reading and writing UFO ZIP.") raise UFOLibError("The fs module is required for reading and writing UFO ZIP.")
path = ZipFS( path = ZipFS(
path, write=True if mode == 'w' else False, encoding="utf8") path, write=True if mode == 'w' else False, encoding="utf8")
roots = path.listdir("") roots = [
p for p in path.listdir("")
# exclude macOS metadata contained in zip file
if path.isdir(p) and p != "__MACOSX"
]
if not roots: if not roots:
self._root = u"contents" self._root = u"contents"
path.makedir(self._root) path.makedir(self._root)