Create parent directories before writing to output target files
Sometimes the output path's parent directory doesn't exist yet, causing a failure in open() syscall. Test: sign_target_files_apks solios-target_files-12328286.zip solis_signed.zip Bug: 364967828 Change-Id: I85f91ca5d1321c1ba763cac058eb28acc7f48e70
This commit is contained in:
@@ -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):
|
||||
|
Reference in New Issue
Block a user