I am porting a C++ codebase which was developed on a Windows platform to Linux/GCC. It seems that the author didn’t care for the case of filenames, so he used
#include "somefile.h"
instead of
#include "SomeFile.h"
to include the file which is actually called “SomeFile.h”. I was wondering if there is any tool out there to automatically fix these includes? The files are all in one directory, so it would be easy for the tool to find the correct names.
EDIT: Before doing anything note that I’m assuming you either have copies of the files off ot the side or preferably that you have a baseline version in source control should you need to roll back for any reason.
You should be able to do this with
sed: Something likesed -i 's/somefile\.h/SomeFile.H/I' *.[Ch]This means take a case-insensitive
somefile(trailing/I) and do an in-place (same file) replacement (-i) with the other text,SomeFile.H.You can even do it in a loop (totally untested):
I should note that although I don’t believe this applies to you, Solaris
seddoesn’t support-iand you’d have to install GNU sed or redirect to a file and rename.