Game Development Community

Sick of newline warnings?

by Rodney Rindels - Torqued · in Torque Game Builder · 07/03/2007 (11:11 pm) · 0 replies

Not exactly the "right" way to go about it, but quick and dirty way.

cd to your engine folder ...

run the following from your command line to find all of your cc and h files and create a fixnewline.sh script
for x in 'find . |grep [.]h$'; do echo $x; echo "echo \"\" >> $x " >> fixnewlines.sh; done
for x in 'find . |grep [.]cc$'; do echo $x; echo "echo \"\" >> $x " >> fixnewlines.sh; done
*** The posting replaced backticks with single quotes around the 'find . |grep [.]h$'.
*** Make sure you change those before running any of these*

***CHECK CHECK CHECK the fixnewlines.sh file to make sure it didn't pick up anything wrong.

add the !#/bin/sh header to the fixnewlines.sh script.

if you really want to clean up the code further, you can run dos2unix on the source files the same way.

for x in 'find . |grep [.]h$'; do echo $x; echo "dos2unix $x " >> fixnewlines.sh; done
for x in 'find . |grep [.]cc$'; do echo $x; echo "dos2unix $x " >> fixnewlines.sh; done

if you are satisfied it created the fixnewlines.sh script properly..

run that bad boy..
sh fixnewlines.sh

Goodbye New lines , and Carat M's

FYI , GG had a similar type solution in a text file in the source
engine/source/ggEndOfLineFix.txt