Merge pull request #665 from dumganhar/iss939_create_qnx_project

add create qnx project script for mac or linux system.
This commit is contained in:
dumganhar 2012-01-10 01:25:48 -08:00
commit 27e4ee1c5f
2 changed files with 84 additions and 1 deletions

83
create_qnx_project.sh Normal file
View File

@ -0,0 +1,83 @@
#!/bin/sh
HELLOWORLD_ROOT=`pwd`/HelloWorld
# make directory qnx and copy all files and directories into it
copy_qnx_folder(){
if [ -d $PROJECT_DIR/qnx ]; then
echo "The '$PROJECT_NAME' project exists, can't override! Please input again!"
create_qnx_project
exit
fi
mkdir $PROJECT_DIR/qnx
echo $HELLOWORLD_ROOT
for file in `ls -a $HELLOWORLD_ROOT/qnx | grep -E '\.(project|cproject|xml|png|cpp)' `
do
file=$HELLOWORLD_ROOT/qnx/$file
if [ -f $file ];then
echo $file
cp $file $PROJECT_DIR/qnx
fi
done
}
copy_cpp_h_from_helloworld(){
if [ -d $PROJECT_DIR/Classes ]; then
echo "Classes folder exists, skip copying Classes folder!"
else
mkdir $PROJECT_DIR/Classes
for file in `ls $HELLOWORLD_ROOT/Classes/* | grep -E '.(cpp|h|mk)' `
do
if [ -f $file ];then
echo $file
cp $file $PROJECT_DIR/Classes
fi
done
fi
}
# copy resources
copy_resouces(){
if [ -d $PROJECT_DIR/Resources ]; then
echo "Resources folder exists, skip copying Resources folder!"
else
mkdir $PROJECT_DIR/Resources
for file in $HELLOWORLD_ROOT/Resource/*
do
echo $file
cp $file $PROJECT_DIR/Resources
done
fi
}
# replace string
modify_file_content(){
# here should use # instead of /, why??
sed "s#HelloWorld#$PROJECT_NAME#" $PROJECT_DIR/qnx/$1 > $PROJECT_DIR/qnx/tmp.txt
rm $PROJECT_DIR/qnx/$1
mv $PROJECT_DIR/qnx/tmp.txt $PROJECT_DIR/qnx/$1
}
create_qnx_project(){
echo "input your project name:"
read PROJECT_NAME
PROJECT_DIR=`pwd`/$PROJECT_NAME
# check if PROJECT_DIR is exist
if [ -d $PROJECT_DIR ]; then
echo ""
else
mkdir $PROJECT_DIR
fi
copy_qnx_folder
modify_file_content .project
modify_file_content .cproject
modify_file_content bar-descriptor.xml
copy_cpp_h_from_helloworld
copy_resouces
echo "Congratulations, the '$PROJECT_NAME' project have been created successfully, please input the project from QNX IDE!"
}
create_qnx_project

View File

@ -33,7 +33,7 @@ move_files_into_android(){
copy_cpp_h_from_helloworld(){
mkdir $APP_DIR/Classes
for file in `ls $HELLOWORLD_ROOT/Classes/* | grep -E '.*\.[cpp|h|mk]' `
for file in `ls $HELLOWORLD_ROOT/Classes/* | grep -E '.*\.(cpp|h|mk)' `
do
if [ -f $file ];then
cp $file $APP_DIR/Classes