@@ -109,22 +109,18 @@ def copy_file_to_src(file_path, library_name):
109109 shutil .copy (file_path , dest_path )
110110 logging .info (f"Copied { file_path } to { dest_path } " )
111111
112- def remove_library_from_src (library_name ):
113- """
114- Removes the specified library file from the 'src/' directory.
115-
116- Args:
117- library_name (str): The name of the library file to remove.
118- """
119- file_path = os .path .join ('src' , library_name )
120- if os .path .exists (file_path ):
121- os .remove (file_path )
122- logging .info (f"Removed { file_path } from src/" )
123-
124112def zip_src_files ():
125113 """
126114 Zips all files in the 'src/' directory into 'btl2capfix.zip', preserving symlinks.
127115 """
116+
117+ if os .path .exists ('btl2capfix.zip' ):
118+ os .remove ('btl2capfix.zip' )
119+ if os .path .exists ('src/libbluetooth_jni.so' ):
120+ os .remove ('src/libbluetooth_jni.so' )
121+ if os .path .exists ('src/libbluetooth_qti.so' ):
122+ os .remove ('src/libbluetooth_qti.so' )
123+
128124 with zipfile .ZipFile ('btl2capfix.zip' , 'w' , zipfile .ZIP_DEFLATED , allowZip64 = True ) as zipf :
129125 for root , dirs , files in os .walk ('src/' ):
130126 for file in files :
@@ -145,7 +141,6 @@ def main():
145141 Main function to execute the script. It performs the following steps:
146142 1. Copies the input file to the 'src/' directory.
147143 2. Patches specific addresses in the binary file.
148- 3. Removes the specified library file from the 'src/' directory.
149144 4. Zips the files in the 'src/' directory into 'btl2capfix.zip'.
150145 """
151146 logging .basicConfig (level = logging .INFO , format = '%(asctime)s - %(levelname)s - %(message)s' )
@@ -171,9 +166,6 @@ def main():
171166 # Copy file to src/
172167 copy_file_to_src (file_path , library_name )
173168
174- # Remove the specified library file from src/
175- remove_library_from_src (library_name )
176-
177169 # Zip files under src/
178170 zip_src_files ()
179171
0 commit comments