diff --git a/root-module-manual/main.py b/root-module-manual/main.py index da411ba..fbf2fd0 100644 --- a/root-module-manual/main.py +++ b/root-module-manual/main.py @@ -109,6 +109,18 @@ def copy_file_to_src(file_path, library_name): shutil.copy(file_path, dest_path) logging.info(f"Copied {file_path} to {dest_path}") +def remove_library_from_src(library_name): + """ + Removes the specified library file from the 'src/' directory. + + Args: + library_name (str): The name of the library file to remove. + """ + file_path = os.path.join('src', library_name) + if os.path.exists(file_path): + os.remove(file_path) + logging.info(f"Removed {file_path} from src/") + def zip_src_files(): """ Zips all files in the 'src/' directory into 'btl2capfix.zip', preserving symlinks. @@ -133,7 +145,8 @@ def main(): Main function to execute the script. It performs the following steps: 1. Copies the input file to the 'src/' directory. 2. Patches specific addresses in the binary file. - 3. Zips the files in the 'src/' directory into 'btl2capfix.zip'. + 3. Removes the specified library file from the 'src/' directory. + 4. Zips the files in the 'src/' directory into 'btl2capfix.zip'. """ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') logger = logging.getLogger() @@ -158,6 +171,9 @@ def main(): # Copy file to src/ copy_file_to_src(file_path, library_name) + # Remove the specified library file from src/ + remove_library_from_src(library_name) + # Zip files under src/ zip_src_files()