Extract SDL zip when making dependencies using purely PowerShell commands

Fixes script crash when the currently used .NET DLL is not found (it's available only in .NET 4.5.1+ and even then it can fail to locate it for some reason).
This commit is contained in:
Pavel Penev
2016-02-27 21:05:57 +02:00
parent fe6c4d8e5c
commit 970f295af0

View File

@@ -70,12 +70,22 @@ if (!(Test-Path "nunit.framework.dll"))
if (!(Test-Path "windows/SDL2.dll")) if (!(Test-Path "windows/SDL2.dll"))
{ {
echo "Fetching SDL2 from libsdl.org" echo "Fetching SDL2 from libsdl.org"
$target = Join-Path $pwd.ToString() "SDL2-2.0.4-win32-x86.zip"
(New-Object System.Net.WebClient).DownloadFile("https://www.libsdl.org/release/SDL2-2.0.4-win32-x86.zip", $target) # Download zip:
$destination = Join-Path $pwd.ToString() "windows" $zipFileName = "SDL2-2.0.4-win32-x86.zip"
Add-Type -assembly "system.io.compression.filesystem" $target = Join-Path $pwd.ToString() $zipFileName
[io.compression.zipfile]::ExtractToDirectory($target, $destination) (New-Object System.Net.WebClient).DownloadFile("https://www.libsdl.org/release/" + $zipFileName, $target)
# Extract zip:
$shell_app=new-object -com shell.application
$currentPath = (Get-Location).Path
$zipFile = $shell_app.namespace($currentPath + "\$zipFileName")
$destination = $shell_app.namespace($currentPath + "\windows")
$destination.Copyhere($zipFile.items())
# Remove junk files:
rm SDL2-2.0.4-win32-x86.zip rm SDL2-2.0.4-win32-x86.zip
rm -path "$currentPath\windows\README-SDL.txt"
} }
if (!(Test-Path "Mono.Nat.dll")) if (!(Test-Path "Mono.Nat.dll"))