mirror of
https://github.com/blawar/ooot.git
synced 2024-07-03 01:23:37 +00:00
29 lines
750 B
Python
29 lines
750 B
Python
import os.path
|
|
from pathlib import Path
|
|
|
|
removeHeaders = ['#include "actor_common.h"', '#include "z64global.h"', '#include "sfx.h"', '#include "sequence.h"', '#include "z64effect.h"']
|
|
|
|
def writeFile(path, buffer):
|
|
with open(path, 'r', encoding="UTF-8") as f:
|
|
if f.read() == buffer:
|
|
return
|
|
|
|
print('writing %s' % path)
|
|
with open(path, 'w', encoding="UTF-8") as f:
|
|
f.write(buffer)
|
|
|
|
header = '#include "actor_common.h"'
|
|
|
|
dir = 'src/overlays/'
|
|
for path in Path(dir).rglob('*.c'):
|
|
x = str(path).replace('\\', '/')
|
|
#print(x)
|
|
with open(x, 'r', encoding="UTF-8") as f:
|
|
buffer = f.read().replace('\r', '')
|
|
|
|
#if header not in buffer:
|
|
for i in removeHeaders:
|
|
buffer = buffer.replace(i + '\n', '')
|
|
|
|
writeFile(x, header + '\n' + buffer)
|
|
|