Use os.path.join instead of appending a "/" since this is os specific.

Remove possible bad conversion to str for path.
This commit is contained in:
j.delarago 2022-06-15 13:26:29 +02:00
parent f7bc55db15
commit 5d0e4238d5

View File

@ -65,7 +65,7 @@ class CuraPackageManager(PackageManager):
paths = [Path(p) for p in glob.glob(path + '/**/*.xml.fdm_material')]
for material in paths:
if material.name == file_name:
with open(str(material), encoding="utf-8") as f:
with open(material, encoding="utf-8") as f:
# Make sure the file we found has the same guid as our material
# Parsing this xml would be better but the namespace is needed to search it.
parsed_guid = PluginRegistry.getInstance().getPluginObject(
@ -87,7 +87,7 @@ class CuraPackageManager(PackageManager):
# File with the name we are looking for is not in this directory
continue
with open(root + "/" + file_name, encoding="utf-8") as f:
with open(os.path.join(root, file_name), encoding="utf-8") as f:
# Make sure the file we found has the same guid as our material
# Parsing this xml would be better but the namespace is needed to search it.
parsed_guid = PluginRegistry.getInstance().getPluginObject("XmlMaterialProfile").getMetadataFromSerialized(