From 2b339b6842e09a3f8c2d915714392e0d48391c5c Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Wed, 6 Dec 2017 18:21:58 +0300 Subject: [PATCH] Cherrypick from develop --- Common/3dParty/cef/download.ps1 | 62 +++++++++++++++++++++++++++++++++ Common/3dParty/cef/fetch.bat | 6 +--- 2 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 Common/3dParty/cef/download.ps1 diff --git a/Common/3dParty/cef/download.ps1 b/Common/3dParty/cef/download.ps1 new file mode 100644 index 0000000000..0bbcfd69ef --- /dev/null +++ b/Common/3dParty/cef/download.ps1 @@ -0,0 +1,62 @@ +Add-Type -AssemblyName System.IO.Compression.FileSystem + +# ---------------------------------------------------------------------------------------------- +# download a file +# ---------------------------------------------------------------------------------------------- +function Download-File +{ + param ([string]$url,[string]$file) + + $downloadRequired = $true + if (Test-Path $file) + { + $localModified = (Get-Item $file).LastWriteTime + $webRequest = [System.Net.HttpWebRequest]::Create($url) + $webRequest.Method = "HEAD" + $webResponse = $webRequest.GetResponse() + $remoteLastModified = ($webResponse.LastModified) -as [DateTime] + $webResponse.Close() + + if ($remoteLastModified -gt $localModified) + { + Write-Host "$file is out of date" + } + else + { + $downloadRequired = $false + } + } + + if ($downloadRequired) + { + $clnt = new-object System.Net.WebClient + Write-Host "Downloading from $url to $file" + $clnt.DownloadFile($url, $file) + } + else + { + Write-Host "$file is up to date." + } + + return $downloadRequired +} + +# ---------------------------------------------------------------------------------------------- +# unzip a file +# ---------------------------------------------------------------------------------------------- +function RemoveCef +{ + param([string]$outpath) + + if (Test-Path $outpath) + { + Write-Host "Remove folder $outpath" + Remove-Item $outpath -Force -Recurse + } +} + +$output = Download-File -url $args[0] -file $args[1] +if ($output) + { + RemoveCef -outpath $args[2] + } \ No newline at end of file diff --git a/Common/3dParty/cef/fetch.bat b/Common/3dParty/cef/fetch.bat index 3ef6598f02..3e49b8cbf6 100644 --- a/Common/3dParty/cef/fetch.bat +++ b/Common/3dParty/cef/fetch.bat @@ -12,11 +12,7 @@ if defined TARGET ( mkdir "%SCRIPTPATH%%PLATFORM%" cd "%SCRIPTPATH%%PLATFORM%" -if exist "cef_binary.7z" ( - echo "cef_binary.7z already downloaded" -) else ( - Powershell.exe Invoke-WebRequest -OutFile cef_binary.7z http://d2ettrnqo7v976.cloudfront.net/cef/2454/%PLATFORM%/cef_binary.7z -) +Powershell.exe -executionpolicy remotesigned -file %SCRIPTPATH%download.ps1 http://d2ettrnqo7v976.cloudfront.net/cef/3163/%PLATFORM%/cef_binary.7z cef_binary.7z cef_binary SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe" SET UNSIP_PROGRAMM2="%ProgramFiles(x86)%\7-Zip\7z.exe"