It is usual practice to write header files first and then the source code. We usually need to go back an forth to get the header file name to start to go with the coding for enterprise projects.
Using the following command, you can convert the header tree to source tree.
find ./include -ls | awk '{print($3,$11);}' | cut -c1,11- | awk '{print($2,$1)}' | sed -e 's/^\.\/include//g' | awk '{if( $2 != "" ) print($1,$2);}' | awk '{if($2 == "d") printf("\"mkdir -p ./src%s\"\n",$1); else{ sub(/\.h$/,".cpp",$1); printf("\"touch ./src%s\"\n",$1);}}' | xargs | /bin/sh
replace .cpp with the extension you want.
It looks like
./include
|----dir1
|------- dir2
|-----------file.h
etc.,
./src
|--------dir1
|-----------dir2
|------------ file.cpp
All header files will replaced with their equivalent name in .c or .cpp with the extension you supply in the command.
Enjoy.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment