Skip to content

Commit

Permalink
update replace header script for vclib-render module
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Feb 26, 2024
1 parent 73d3f02 commit ac798bb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/replace_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ def replace_cmake_headers_in_dir(folder_path, recursive=True):
elif file_path.endswith(('CMakeLists.txt', '.cmake')):
replace_header(file_path, header_string, start='#*')

def replace_shader_headers_in_dir(folder_path):
# get the path where this script is located
path = os.path.dirname(os.path.abspath(__file__))

# Read in the file
with open(path + '/templates/header.txt', 'r') as file :
header_string = file.read()

for file_path in glob.glob(os.path.join(folder_path, '*')):
if os.path.isdir(file_path):
replace_shader_headers_in_dir(file_path)
elif file_path.endswith(('.sc', '.sh')):
replace_header(file_path, header_string)

if __name__ == "__main__":
replace_headers_in_dir('../include/vclib/')
replace_headers_in_dir('../test/')
Expand All @@ -58,3 +72,10 @@ def replace_cmake_headers_in_dir(folder_path, recursive=True):
replace_cmake_headers_in_dir('../external/', recursive=False)
replace_cmake_headers_in_dir('../cmake/')
replace_cmake_headers_in_dir('../test/')

# for vclib-render module, that has sources and shaders in different folders
if os.path.exists('../src/'):
replace_headers_in_dir('../src/')

if os.path.exists('../shaders/'):
replace_shader_headers_in_dir('../shaders/')

0 comments on commit ac798bb

Please sign in to comment.