From 97548b01c7f0e08eb413f15b235350d6b8d3f1b7 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 2 Apr 2019 16:38:28 +0300 Subject: [PATCH] FFmpeg: try to download wrapper with elevated privileges --- 3rdparty/ffmpeg/ffmpeg-download.ps1.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/3rdparty/ffmpeg/ffmpeg-download.ps1.in b/3rdparty/ffmpeg/ffmpeg-download.ps1.in index e92ef45a9b..999cd6f11f 100644 --- a/3rdparty/ffmpeg/ffmpeg-download.ps1.in +++ b/3rdparty/ffmpeg/ffmpeg-download.ps1.in @@ -12,6 +12,22 @@ Write-Output ("=" * 120) Write-Output "" if(![System.IO.File]::Exists($output)) { + try { + [io.file]::OpenWrite($output).close() + } catch { + Write-Warning "Unable to write: $output" + if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { + Write-Warning "Launching with 'Administrator' elevated privileges..." + Pause + Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs + exit + } else { + Write-Output "FATAL: Unable to write with elevated privileges: $output" + Pause + exit 1 + } + } + try { Write-Output ("Downloading: " + $output) Import-Module BitsTransfer