#!/usr/bin/env python3 """ Ersetzt ppm_dtc.h Includes durch ppm.hpp """ import os import re base_dir = "/home/torsten/swy/sandbox/qt-migration-legatus/qt6-after/qt6-migrated-legatus" # Finde alle .h, .cpp, .hpp Dateien changed_count = 0 for root, dirs, files in os.walk(base_dir): # Skip build directories if 'build' in root or '.git' in root: continue for file in files: if file.endswith(('.h', '.cpp', '.hpp')): filepath = os.path.join(root, file) try: with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: content = f.read() # Ersetze ppm_dtc.h durch ppm.hpp if 'ppm_dtc.h' in content: new_content = content.replace( '#include ', '#include ' ) new_content = new_content.replace( '#include "ParticipantManagement/ppm_dtc.h"', '#include "ParticipantManagement/ppm.hpp"' ) if new_content != content: with open(filepath, 'w', encoding='utf-8') as f: f.write(new_content) changed_count += 1 print(f"Updated: {filepath}") except Exception as e: print(f"Error processing {filepath}: {e}") print(f"\n=== Summary ===") print(f"Files updated: {changed_count}")