mirror of
https://github.com/open-goal/jak-project
synced 2026-07-07 06:05:15 -04:00
Script to add #pragma once headers
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import os
|
||||
from glob import glob
|
||||
|
||||
|
||||
folders = sys.argv
|
||||
cwd = os.getcwd()
|
||||
|
||||
for folder in folders:
|
||||
directory = os.path.join(cwd, folder)
|
||||
files = [y for x in os.walk(directory) for y in glob(os.path.join(x[0], '*.h'))]
|
||||
for fPath in files:
|
||||
print("Processing %s" % fPath)
|
||||
with open(fPath, 'r+') as f:
|
||||
content = f.read()
|
||||
f.seek(0, 0)
|
||||
if (content.startswith("#pragma once") == False):
|
||||
f.write("#pragma once\n\n" + content)
|
||||
|
||||
Reference in New Issue
Block a user