mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
43 lines
673 B
Batchfile
43 lines
673 B
Batchfile
|
@:: Usage:
|
||
|
@:: call GetRsVersion.bat Define Variable
|
||
|
|
||
|
@setlocal
|
||
|
@echo off
|
||
|
|
||
|
set Define=%~1
|
||
|
if "%Define%"=="" (
|
||
|
echo.
|
||
|
echo Parameter error
|
||
|
endlocal
|
||
|
exit /B1
|
||
|
)
|
||
|
|
||
|
set Variable=%~2
|
||
|
if "%Variable%"=="" (
|
||
|
echo.
|
||
|
echo Parameter error
|
||
|
endlocal
|
||
|
exit /B1
|
||
|
)
|
||
|
|
||
|
set Result=
|
||
|
set VersionFile="%~dp0..\..\libretroshare\src\retroshare\rsversion.h"
|
||
|
|
||
|
if not exist "%VersionFile%" (
|
||
|
echo.
|
||
|
echo Version file doesn't exist.
|
||
|
echo %VersionFile%
|
||
|
endlocal
|
||
|
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
|