2016-09-06 15:31:41 -04:00
|
|
|
:: Usage:
|
|
|
|
:: call get-rs-version.bat Define Variable
|
2015-08-04 13:02:13 -04:00
|
|
|
|
2016-09-06 15:31:41 -04:00
|
|
|
setlocal
|
2015-08-04 13:02:13 -04:00
|
|
|
|
|
|
|
set Define=%~1
|
|
|
|
set Variable=%~2
|
|
|
|
if "%Variable%"=="" (
|
|
|
|
echo.
|
2016-09-06 15:31:41 -04:00
|
|
|
echo Parameter error.
|
|
|
|
exit /B 1
|
2015-08-04 13:02:13 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
set Result=
|
2016-09-06 15:31:41 -04:00
|
|
|
set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h"
|
2015-08-04 13:02:13 -04:00
|
|
|
|
|
|
|
if not exist "%VersionFile%" (
|
|
|
|
echo.
|
|
|
|
echo Version file doesn't exist.
|
|
|
|
echo %VersionFile%
|
|
|
|
exit /B1
|
|
|
|
)
|
|
|
|
|
|
|
|
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do (
|
|
|
|
if "%%A"=="#define" (
|
|
|
|
if "%%B"=="%Define%" (
|
|
|
|
set Result=%%~C
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
endlocal & set %Variable%=%Result%
|
|
|
|
exit /B 0
|