mirror of
https://github.com/LizardByte/Sunshine.git
synced 2024-12-27 06:16:15 +00:00
41 lines
793 B
Python
41 lines
793 B
Python
# standard imports
|
|
import os
|
|
import subprocess
|
|
|
|
# variables
|
|
directories = [
|
|
'src',
|
|
'tests',
|
|
'tools',
|
|
os.path.join('third-party', 'glad'),
|
|
os.path.join('third-party', 'nvfbc'),
|
|
]
|
|
file_types = [
|
|
'cpp',
|
|
'h',
|
|
'm',
|
|
'mm'
|
|
]
|
|
|
|
|
|
def clang_format(file: str):
|
|
print(f'Formatting {file} ...')
|
|
subprocess.run(['clang-format', '-i', file])
|
|
|
|
|
|
def main():
|
|
"""
|
|
Main entry point.
|
|
"""
|
|
# walk the directories
|
|
for directory in directories:
|
|
for root, dirs, files in os.walk(directory):
|
|
for file in files:
|
|
file_path = os.path.join(root, file)
|
|
if os.path.isfile(file_path) and file.rsplit('.')[-1] in file_types:
|
|
clang_format(file=file_path)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|