dodany kod c od Krzyska po wielu modyfikacjach przez Gemini zeby usunac zalezność od TI-RTOS
This commit is contained in:
29
fix_includes.py
Normal file
29
fix_includes.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import re
|
||||
import os
|
||||
|
||||
def fix_includes_in_file(file_path):
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8', errors='ignore') as f:
|
||||
content = f.read()
|
||||
|
||||
new_content = re.sub(r'#include "../(tdefs\.h|config\.h|misc\.h|logman\.h|comm\.h)"', r'#include "\1"', content)
|
||||
|
||||
if new_content != content:
|
||||
with open(file_path, 'w', encoding='utf-8') as f:
|
||||
f.write(new_content)
|
||||
print(f"Fixed includes in {file_path}")
|
||||
except FileNotFoundError:
|
||||
print(f"File not found: {file_path}")
|
||||
except Exception as e:
|
||||
print(f"Error processing {file_path}: {e}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
for root, dirs, files in os.walk('src'):
|
||||
for file in files:
|
||||
if file.endswith(('.c', '.h')):
|
||||
fix_includes_in_file(os.path.join(root, file))
|
||||
|
||||
fix_includes_in_file('ZDistA_komp.c')
|
||||
fix_includes_in_file('ZDistA_komp.h')
|
||||
|
||||
print("Done fixing includes.")
|
||||
Reference in New Issue
Block a user