Skip to content

Commit a2ccff6

Browse files
authored
fix(bcf): Create directory entries in the zip file's central directory (#7175)
This is done to comply with the Implementation Agreements https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#create-directory-folder-entries-in-the-zip-files-central-directory
1 parent 8e045d7 commit a2ccff6

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/bcf/bcf/v2/topic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ def save(self, destination_zip: ZipFileInterface) -> None:
192192
bcf_zip: The BCF zip file to save to.
193193
"""
194194
topic_dir = self.guid
195+
# simulating directory creation (ZipFile in python < 3.11 doesn't have mkdir)
196+
destination_zip.writestr(f"{topic_dir}/", "")
195197
self._save_xml(destination_zip, self._markup, "markup.bcf")
196198
self._save_viewpoints(destination_zip, topic_dir)
197199
self._save_bim_snippet(destination_zip)

src/bcf/bcf/v3/topic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ def save(self, destination_zip: ZipFileInterface) -> None:
179179
bcf_zip: The BCF zip file to save to.
180180
"""
181181
topic_dir = self.guid
182+
# simulating directory creation (ZipFile in python < 3.11 doesn't have mkdir)
183+
destination_zip.writestr(f"{topic_dir}/", "")
182184
self._save_xml(destination_zip, self._markup, "markup.bcf")
183185
self._save_viewpoints(destination_zip, topic_dir)
184186
self._save_bim_snippet(destination_zip)

0 commit comments

Comments
 (0)