[solved] renaming include files...any way to automate editing?
So, let's say I have an include file that I wish to rename, and its old name is already scattered through many source files. Is there a way to automate this within Creator, or am I stuck with good old cut-and-paste?
I'm sure I could do it with a shell script, but...I haven't done that stuff in decades.
Just use the global search/replace. Cmd-Shift-F (you're on a Mac, aren't you? :) )
in the search field, enter * into the file pattern, check case sensitive, search in all projects and click on the "search & replace" button. You'll get a list of the files and the lines that match and on top you can enter the replacement
Thanks, Volker. Now that you've shown it to me, I can see that it's available through Edit->Find/Replace->Advanced Find. (It's easier for me to remember the menu paths than all the meta-key commands.) I see it can be used on symbols as well as text, though the "Search & Replace" button is ghosted out for that option.
This is a very handy feature; thanks for showing it to me.
For symbols, there is a more convenient (and safe!) way: go to the symbol you want to rename and hit Cmd-Shift-R (or choose refactoring / rename symbol from the context menu). In case the symbol is used in the current file only, you can edit in-place, in case it's spread over multiple files, a search result tab similar to that of the globals search/replace pops up. This way renaming a symbol is much more safe, as it works on the parsed C++ code (and you do not need to take care of such problems like renaming "i" to "row" and also catching "i2" and making it "row2").