aboutsummaryrefslogtreecommitdiff
path: root/NvBlast/buildtools/packman/windows/configure/fetch_file.cmd
diff options
context:
space:
mode:
authorBryan Galdrikian <[email protected]>2017-02-21 12:07:59 -0800
committerBryan Galdrikian <[email protected]>2017-02-21 12:07:59 -0800
commit446ce137c6823ba9eff273bdafdaf266287c7c98 (patch)
treed20aab3e2ed08d7b3ca71c2f40db6a93ea00c459 /NvBlast/buildtools/packman/windows/configure/fetch_file.cmd
downloadblast-446ce137c6823ba9eff273bdafdaf266287c7c98.tar.xz
blast-446ce137c6823ba9eff273bdafdaf266287c7c98.zip
first commitv1.0.0-beta
Diffstat (limited to 'NvBlast/buildtools/packman/windows/configure/fetch_file.cmd')
-rw-r--r--NvBlast/buildtools/packman/windows/configure/fetch_file.cmd23
1 files changed, 23 insertions, 0 deletions
diff --git a/NvBlast/buildtools/packman/windows/configure/fetch_file.cmd b/NvBlast/buildtools/packman/windows/configure/fetch_file.cmd
new file mode 100644
index 0000000..298b6a0
--- /dev/null
+++ b/NvBlast/buildtools/packman/windows/configure/fetch_file.cmd
@@ -0,0 +1,23 @@
+:: You need to specify <package-source> <package-name> <package-guid> <target-name> as input to this command
+
+@set PACKAGE_NAME=%2
+@set PACKAGE_GUID=%3
+@set TARGET=%4
+
+@echo Fetching %PACKAGE_NAME% from %1 ...
+
+@if ["%1"] EQU ["s3"] set SOURCE_OPT=-sourceName %PACKAGE_NAME%
+@if ["%1"] EQU ["gtl"] set SOURCE_OPT=-sourceGUID %PACKAGE_GUID%
+
+@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_%1.ps1" %SOURCE_OPT% -output %TARGET%
+:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option
+:: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes:
+@if not exist %TARGET% goto ERROR_DOWNLOAD_FAILED
+@if %~z4==0 goto ERROR_DOWNLOAD_FAILED
+
+@exit /b 0
+
+:ERROR_DOWNLOAD_FAILED
+@echo Failed to download file from %1
+@echo Most likely because endpoint cannot be reached (VPN connection down?)
+@exit /b 1 \ No newline at end of file