@Echo Off
Set tmpPath=%Path%
Set Path=%Path%;..\_Outils\SubVersion\
Set baseVersion=1

Cls
Set svnVersion=%2
REM Mise à jour manuelle
If "%1"=="manual" (
    If Not "%2"=="" Goto manualSVN
)

REM Une fois pour mettre à jour le projet...
svn update .>nul
REM Une seconde fois pour la version
svn update .>svn.tmp
If Not "%ERRORLEVEL%"=="0" (
    REM Erreur d'exécution de "svn update"
    Del svn.tmp
    Cls
    Echo Error executing command "svn update". No changes done.
    Goto noSVN
)
Set /P svnVersion=<svn.tmp
Del svn.tmp
Set svnVersion=%svnVersion:~12,-1%
Set /A svnVersion+=1
:manualSVN

Echo Generating version files to version %baseVersion%.%svnVersion% ...
Echo _______________________________________
Echo   - version.hpp
Echo #define SVN_VERSION "%baseVersion%.%svnVersion%" >src\Darlinko\version.hpp
Echo   - resVersion.h
Echo // Versions (ne pas oublier de finir la BUILD_RES_VERSION_FULL par "\0") >res\build\resVersion.h
Echo #define BUILD_RES_VERSION_FULL      "%baseVersion%.0.0.%svnVersion%\0" >>res\build\resVersion.h
Echo #define BUILD_RES_VERSION_MAJOR     %baseVersion% >>res\build\resVersion.h
Echo #define BUILD_RES_VERSION_MINOR     0 >>res\build\resVersion.h
Echo #define BUILD_RES_VERSION_PATCH     0 >>res\build\resVersion.h
Echo #define BUILD_RES_VERSION_REVISION  %svnVersion% >>res\build\resVersion.h
Echo   - version.txt
Echo %baseVersion%.%svnVersion%>res\build\version.txt
Echo.>>res\build\version.txt
Echo   - makeSFO.bat
Set /P APP_TITLE=<res\build\title.txt
Echo @..\_Outils\pspSDK\bin\mksfo "%APP_TITLE% v%baseVersion%.%svnVersion%" release\PARAM.SFO>makeSFO.bat
Echo _______________________________________
Echo.
:noSVN
Set Path=%tmpPath%
