aboutsummaryrefslogtreecommitdiff
path: root/utils/getShaveVersion.bat
blob: ec8faf2a2a0b8fef5cecc8b34da9eba01edade69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@echo off

rem  Shave and a Haircut
rem  (c) 2019 Epic Games
rem  US Patent 6720962

rem  This script extracts the current Shave version string from the
rem  shaveVersion.mel script file and place it into the 'shaveVersion'
rem  environment variable.

rem  We need the shaveVersion.mel script so let's make sure it exists.

if not exist scripts\shaveVersion.mel goto noFile
    find "return" <scripts\shaveVersion.mel > version.dat
    set /p shaveVersion=<version.dat
    del version.dat

    rem
    rem  Note that because of the recursive nature of these assignments
    rem  (i.e. shaveVersion is being defined in terms of shaveVersion)
    rem  they will not work inside an 'if cond (...) else (...)' construct
    rem  because Windows treats that as a single statement and does variable
    rem  substitution once, when the statement is read in, not as each
    rem  statement is executed. So we have to use the 'if cond goto' construct
    rem  instead.
    rem
    set shaveVersion=%shaveVersion:return=%
    set shaveVersion=%shaveVersion:"=%
    set shaveVersion=%shaveVersion:;=%
    set shaveVersion=%shaveVersion: =%
    set shaveVersion=%shaveVersion:	=%

    set result=0

goto done
:noFile
    echo Error: cannot find scripts\shaveVersion.mel.  Build terminated.
    set result=1
:done