mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Cherrypick from develop
This commit is contained in:
62
Common/3dParty/cef/download.ps1
Normal file
62
Common/3dParty/cef/download.ps1
Normal file
@ -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]
|
||||
}
|
||||
@ -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"
|
||||
|
||||
Reference in New Issue
Block a user