Merge "Create parent directories before writing to output target files" into main

This commit is contained in:
Treehugger Robot
2024-09-06 22:44:14 +00:00
committed by Gerrit Code Review

View File

@@ -3238,7 +3238,9 @@ class File(object):
return t
def WriteToDir(self, d):
with open(os.path.join(d, self.name), "wb") as fp:
output_path = os.path.join(d, self.name)
os.makedirs(os.path.dirname(output_path), exist_ok=True)
with open(output_path, "wb") as fp:
fp.write(self.data)
def AddToZip(self, z, compression=None):