Skip to content

Instantly share code, notes, and snippets.

@zilongshanren
Last active August 29, 2015 13:57
Show Gist options
  • Save zilongshanren/9362907 to your computer and use it in GitHub Desktop.
Save zilongshanren/9362907 to your computer and use it in GitHub Desktop.
A batch file to verify the state of the android development with cocos2d-x
@echo off
setlocal EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
rem Prepare a file "X" with only one dot
<nul > X set /p ".=."
::call :color 1a "a" 1a is green
::call :color 1b "b" 1b is blu
::call :color 1c "^!<>&| %%%%"*?" 1c is red
echo "Checking Environment Variable..."
echo .
if "%JAVA_HOME%"=="" (call :color 1c "JAVA_HOME is not defined %NL%"
)else (call :color 1a "JAVA_HOME is ok...%NL%"
)
if "%ANDROID_SDK_ROOT%"=="" (call :color 1c "ANDROID_SDK_ROOT is not defined"
) else (call :color 1a "ANDROID_SDK_ROOT is ok ...")
if "%ANT_HOME%"=="" (call :color 1c "ANT_HOME is not defined"
) else (call :color 1a "ANT_HOME is ok...")
if "%NDK_ROOT%"=="" (call :color 1c "NDK_ROOT is not defined"
) else (call :color 1a "NDK_ROOT is ok...")
echo "Checking ndk-build.cmd file..."
if exist %NDK_ROOT%\ndk-build.cmd (call :color 1a "Your NDK_ROOT environment variable is correcot!"
)else (call :color 1c "NDK_ROOT path is wrong!")
echo "Checking android.bat program..."
if exist %ANDROID_SDK_ROOT%\tools\android.bat (call :color 1a "You android.bat program is ok..."
)else (call :color 1c "You ANDROID_SDK_ROOT environment may be not set the correct value")
call :color 1a "Checking pyhton.exe"
python --version
call :color 1a "Checking java.exe"
java -version
call :color 1a "Checking ant.exe"
ant -version
pause > nul
echo Your current environment is OK! Press Any Key to continue...
pause > nul
:color
set "param=^%~2" !
set "param=!param:"=\"!"
findstr /p /A:%1 "." "!param!\..\X" nul
<nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%"
echo .
echo .
@zilongshanren
Copy link
Author

You can just copy&paste the code into a .bat file and issue your cmd window, drag and drop the file, execute it.

At last, if your environment is ok, all thing should be green.

@sidshekar
Copy link

is there s a similar one for 2.2.2???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment