Better path to packages.json in the 3MF file

Let's put it in the Cura directory with the rest of such files, as to not muddy the 3MF file with all sorts of directories that are not known to other consumers.

Contributes to issue CURA-9413.
This commit is contained in:
Ghostkeeper 2022-06-20 11:04:14 +02:00
parent d1747e09e1
commit 8970f46154
No known key found for this signature in database
GPG key ID: 68F39EA88EEED5FF
2 changed files with 3 additions and 3 deletions

View file

@ -1253,12 +1253,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
@staticmethod
def _parse_packages_metadata(archive: zipfile.ZipFile) -> List[Dict[str, str]]:
try:
package_metadata = json.loads(archive.open("Metadata/packages.json").read().decode("utf-8"))
package_metadata = json.loads(archive.open("Cura/packages.json").read().decode("utf-8"))
return package_metadata["packages"]
except KeyError:
Logger.warning("No package metadata was found in .3mf file.")
except Exception:
Logger.error("Failed to load packes metadata from .3mf file")
Logger.error("Failed to load packages metadata from .3mf file.")
return []