From f88be86978af5ebb92bc9f11e99015afc6b6c4f7 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Wed, 21 Feb 2024 14:19:14 +0200 Subject: Initial impl of step --- atk16_utils/pad_bin.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'atk16_utils/pad_bin.py') diff --git a/atk16_utils/pad_bin.py b/atk16_utils/pad_bin.py index 9f014d1..1c3c24d 100644 --- a/atk16_utils/pad_bin.py +++ b/atk16_utils/pad_bin.py @@ -14,6 +14,9 @@ def pad_binary(file_path, target_size) -> int: # Calculate needed padding padding_size = target_size - current_size + if padding_size < 0: + raise ValueError(f"File is larger than the target size ({current_size} > {target_size}).") + # Append zeros if needed if padding_size > 0: with open(file_path, 'ab') as file: -- cgit v1.3