diff --git a/tools/make.py b/tools/make.py index c7dfd2e4fb..382f8dd776 100644 --- a/tools/make.py +++ b/tools/make.py @@ -309,12 +309,12 @@ def copy_important_files(source_dir,destination_dir): "logo_ace3_ca.paa" ] - print_yellow ("source_dir: " + source_dir) - print_yellow("destination_dir: " + destination_dir) - #copy importantFiles try: print_blue("\nSearching for important files in " + source_dir) + print("Source_dir: " + source_dir) + print("Destination_dir: " + destination_dir) + for file in importantFiles: print_green("Copying file => " + os.path.join(source_dir,file)) shutil.copyfile(os.path.join(source_dir,file),os.path.join(destination_dir,file)) @@ -449,6 +449,13 @@ def build_signature_file(file_name): return True else: return False + + +def check_for_obsolete_pbos(addonspath, file): + module = file[4:-4] + if not os.path.exists(os.path.join(addonspath, module)): + return True + return False ############################################################################### @@ -759,6 +766,15 @@ See the make.cfg file for additional build options. key = os.path.join(private_key_path, key_name + ".biprivatekey") + # Remove any obsolete files. + print_blue("\nChecking for obsolete files...") + obsolete_check_path = os.path.join(module_root, release_dir, project,"addons") + for file in os.listdir(obsolete_check_path): + if (file.endswith(".pbo") and os.path.isfile(os.path.join(obsolete_check_path,file))): + if check_for_obsolete_pbos(module_root, file): + fileName = os.path.splitext(file)[0] + print_yellow("Removing obsolete file => " + file) + purge(obsolete_check_path,fileName+"\..",fileName+".*") # For each module, prep files and then build. print_blue("\nBuilding...") @@ -1044,8 +1060,6 @@ See the make.cfg file for additional build options. except: print_error("ERROR: Could not delete pboProject temp files.") - print_green("\nDone.") - copy_important_files(module_root_parent,os.path.join(release_dir, "@ace")) cleanup_optionals(optionals_modules) @@ -1087,6 +1101,9 @@ See the make.cfg file for additional build options. shutil.copytree(os.path.join(module_root, release_dir, project), os.path.join(a3_path, project)) except: print_error("Could not copy files. Is Arma 3 running?") + + print_green("\nDone.") + if __name__ == "__main__": main(sys.argv)