the parent directory might not already exist, so we have to call makedir with recursive=true to auto-create any parent folders

This commit is contained in:
Chris Dodge
2013-01-10 14:41:19 -05:00
parent bcafc5fdfb
commit dc8f23d6ae

View File

@@ -379,7 +379,7 @@ class XmlDescriptor(XModuleDescriptor):
# Write the definition to a file
url_path = name_to_pathname(self.url_name)
filepath = self.__class__._format_filepath(self.category, url_path)
resource_fs.makedir(os.path.dirname(filepath), allow_recreate=True)
resource_fs.makedir(os.path.dirname(filepath), recursive=True, allow_recreate=True)
with resource_fs.open(filepath, 'w') as file:
file.write(etree.tostring(xml_object, pretty_print=True, encoding='utf-8'))