aboutsummaryrefslogtreecommitdiff
path: root/tools/fix_headers.rb
blob: 6d23ed69197a2375a87867108f3ae185ee290b58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/ruby

 # for all files

file_names = Dir.glob("**/*.h") + Dir.glob("**/*.cpp")
new_header = File.read('new_header')
old_header = File.read('old_header')

file_names.each do |file_name|
  text = File.read(file_name)
  new_contents = text.gsub(old_header, new_header)

  # To merely print the contents of the file, use:
  #puts new_contents

  # To write changes to the file, use:
  File.open(file_name, "w") {|file| file.puts new_contents }
end