Merge pull request #567 from klpn/cursize-fix

Check image size and pad after closing first with statement
This commit is contained in:
Samuel Tyler 2026-01-30 19:34:30 +11:00 committed by GitHub
commit 8b832a1e58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -246,6 +246,9 @@ class Generator():
with open(os.path.join('builder-hex0', 'builder-hex0-x86-stage2.hex0'),
encoding="utf-8") as infile:
image_file.write(infile.read().encode())
# Close first with statement before getting file size.
with open(image_file_name, 'ab') as image_file:
# Pad to next sector
current_size = os.stat(image_file_name).st_size
while current_size % 512 != 0: