axmol/create-bada-project.bat

98 lines
2.7 KiB
Batchfile
Raw Normal View History

2011-10-24 18:36:32 +08:00
@echo off
:: This script is used to create an bada project.
:: Don't change it until you know what you do.
setlocal
setlocal enabledelayedexpansion
set COCOS2DX_ROOT=%cd%
set /p PROJECT_NAME=please input project name:
2011-10-25 14:12:42 +08:00
if /i %PROJECT_NAME%==tests (
echo can't not use "tests" as a project name, because it is used for cocos2dx tests project.
goto END
)
if /i %PROJECT_NAME%==HelloWorld (
echo can't not use "HelloWorld" as a project name, because it is used for cocos2dx HelloWorld project.
goto END
)
2011-10-24 18:36:32 +08:00
if not exist %PROJECT_NAME% md %PROJECT_NAME%
cd %PROJECT_NAME%
set PROJECT_ROOT=%COCOS2DX_ROOT%\%PROJECT_NAME%
2011-10-25 10:53:33 +08:00
echo project root = %PROJECT_ROOT%
2011-10-24 18:36:32 +08:00
if not exist bada (
md Resource
md bada\sdk1.0\Icons
md bada\sdk1.0\Res
md bada\sdk2.0\Icons
md bada\sdk2.0\Res
md bada\src
) else (
echo "bada project exist!"
2011-10-25 14:12:42 +08:00
goto END
2011-10-24 18:36:32 +08:00
)
xcopy /y /s %COCOS2DX_ROOT%\HelloWorld\Resource\*.* Resource
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk1.0\Icons bada\sdk1.0\Icons
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk1.0\.badaprj bada\sdk1.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk1.0\.cproject bada\sdk1.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk1.0\.project bada\sdk1.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk1.0\application.xml bada\sdk1.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk1.0\manifest.xml bada\sdk1.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\src bada\src
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk2.0\Icons bada\sdk2.0\Icons
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk2.0\.badaprj bada\sdk2.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk2.0\.cproject bada\sdk2.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk2.0\.project bada\sdk2.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk2.0\application.xml bada\sdk2.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\sdk2.0\manifest.xml bada\sdk2.0
copy /y %COCOS2DX_ROOT%\HelloWorld\bada\src bada\src
2011-10-25 11:01:21 +08:00
if not exist Classes (
md Classes
xcopy /y /s %COCOS2DX_ROOT%\HelloWorld\Classes\*.* Classes
) else (
2011-10-25 14:12:42 +08:00
echo "Classes folder exist, it will not be override!"
2011-10-25 11:01:21 +08:00
)
2011-10-24 18:36:32 +08:00
:: rename HelloWorldEntry.cpp
move bada\src\HelloWorldEntry.cpp bada\src\%PROJECT_NAME%Entry.cpp
cd bada\sdk1.0
call :replace .cproject
call :replace .project
2011-10-25 14:12:42 +08:00
call :replace application.xml
2011-10-24 18:36:32 +08:00
cd ..\..\bada\sdk2.0
call :replace .cproject
call :replace .project
2011-10-25 14:12:42 +08:00
call :replace application.xml
echo Congratulations, %PROJECT_NAME% project have been created, please import the project from BadaIDE.
2011-10-24 18:36:32 +08:00
2011-10-25 14:12:42 +08:00
:END
2011-10-24 18:36:32 +08:00
endlocal
pause
exit
:replace
for /f "tokens=1* delims=:" %%a in ('findstr /n .* "%1"') do (
if "%%b"=="" (
echo\>>tmp.txt
) else (
set "var=%%b"
set "var=!var:HelloWorld=%PROJECT_NAME%!"
2011-10-25 10:53:33 +08:00
echo !var!>>tmp.txt
2011-10-24 18:36:32 +08:00
)
)
move tmp.txt %1