@echo off
setlocal ENABLEDELAYEDEXPANSION
:: 使用说明，将MyEclipse10文件目录拖动到该批处理上
set epath=%~1
:spath
if "" == "%~1" (
	echo Enter MyEclipse Install Path
	set /p epath=
)
if %epath:~-1%==\ set epath=%epath:~0,-1%

call :getMEFolderName


:step1
if not exist "%epath%\common\language" md "%epath%\common\language"
xcopy /s /h /y ".\language" "%epath%\common\language\"

:step2
if not exist "%epath%\%mefn%\configuration\org.eclipse.equinox.simpleconfigurator" md "%epath%\%mefn%\configuration\org.eclipse.equinox.simpleconfigurator"
for /f "tokens=*" %%i in ('dir /s /b /a:-d %epath%\common\language\plugins\*') do (
	set lib=%%~ni
	set lib=!lib:_0=,0!
	set lib=!lib:_1=,1!
	set lib=!lib:_2=,2!
	set lib=!lib:_3=,3!
	set lib=!lib:_4=,4!
	set lib=!lib:_5=,5!
	set lib=!lib:_6=,6!
	set lib=!lib:_7=,7!
	set lib=!lib:_8=,8!
	set lib=!lib:_9=,9!
	set lib=!lib!,file:/%%~dpnxi,4,false
	echo !lib:\=/! >> "%epath%\%mefn%\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info"
)

:step3
if not exist "%epath%\%mefn%" md "%epath%\%mefn%"
echo -Duser.language=zh >> "%epath%\%mefn%\myeclipse.ini"

@echo all done!
pause
exit

:getMEFolderName
for /f "tokens=*" %%a in ('dir /b /a:d %epath%\MyEclipse*') do @set mefn=%%a
exit /b

:debug
call :getMEFolderName
echo %mefn%
@pause

rem Scripy by zuozhiwen
rem 22:26 2013/9/28