forked from ConfettiFX/The-Forge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PRE_BUILD.bat
77 lines (58 loc) · 1.67 KB
/
PRE_BUILD.bat
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
:: ENTRY POINT
::
@echo off
@SETLOCAL EnableDelayedExpansion
:: Change active working directory in case we run script for outside of TheForge
cd /D "%~dp0"
:: Install Shader Build Command extension if it's not installed
call :CheckIfExtensionInstalled "ShaderBuildCommand"
set ShaderBuildCommandInstalled=%errorlevel%
if %ShaderBuildCommandInstalled% EQU 0 (
echo Installing Shader Build Extension
"Tools/ShaderBuildCommand.vsix"
) else (
echo Shader Build Extension Already Installed.
)
set filename=Art.zip
if exist %filename% (
del %filename%
)
echo Pulling Art Assets
"Tools/wget" -O %filename% http://www.conffx.com/%filename%
echo Unzipping Art Assets...
"Tools/7z" x %filename% -y > NUL
echo Finishing up...
del %filename%
exit /b 0
:: Goes through non-admin Extension directory of all visual studio versions
:: which live in %LOCALAPPDATA% - admin ones live in %ProgramFiles% - and
:: checks for the extension files: returns 1 if they exist, 0 if not
::
:CheckIfExtensionInstalled
set VS_Extension_Root_Dir=%LOCALAPPDATA%\Microsoft\VisualStudio\
:: get the vs extension name, strip it from quotes
set Extension_Name=%~1
::---Debug
::echo Checking if Extension installed: %Extension_Name%
::---Debug
:: change dir to extension root dir and search for the Extension_Name
:: passed as the first parameter in %1
pushd "%VS_Extension_Root_Dir%"
set /A NumFilesFound=0
for /R %%G in ("*%Extension_Name%.pkgdef") do (
::---Debug
::@echo "%%G"
::---Debug
set /A NumFilesFound=%NumFilesFound% + 1
)
popd
::---Debug
::echo NumFilesFound=%NumFilesFound%
::---Debug
if %NumFilesFound% EQU 0 (
exit /b 0
) else (
exit /b 1
)
exit /b 0
EXIT /B %RETURN_CODE%