#!/bin/bash
for i in $*
do
rm -f /tmp/dirname
echo $i > /tmp/dirname
INAME=`sed -e s/"\."/_/g /tmp/dirname`
echo $INAME

# Directory
rm -rf $INAME
mkdir $INAME

# C++ file: put a header with cross-platform include, comment out Inventor/Xt includes, declare main as int.
cp myHeader.txt $INAME/$INAME.cpp
sed -e s/"\#include\ <Inventor\/Xt\/"/"\/\/\#include\ <Inventor\/Xt\/"/g \
    -e s/"\/usr\/share\/src\/Inventor\/examples\/data"/"..\/..\/Data\/models"/g \
    -e s/SoXt::mainLoop\(\)\;/SoXt::mainLoop\(\)\;\ return\ 0\;/g \
    $i.c++ >> $INAME/$INAME.cpp

# qmake .pro file
sed -e s/THE-EXAMPLE/$INAME/g template-pro.txt > $INAME/$INAME.pro

# Kdevelop project file
sed -e s/THE-EXAMPLE/$INAME/g template-kdevelop.txt > $INAME/$INAME.kdevelop

done
 
