Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion windows/deploy_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ param(
[string] $AsioSDKName = "ASIOSDK2.3.2",
[string] $AsioSDKUrl = "https://www.steinberg.net/sdk_downloads/ASIOSDK2.3.2.zip",
[string] $NsisName = "nsis-3.06.1",
[string] $NsisUrl = "https://jztkft.dl.sourceforge.net/project/nsis/NSIS%203/3.06.1/nsis-3.06.1.zip"
[string] $NsisUrl = "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.06.1/nsis-3.06.1.zip"
)

# change directory to the directory above (if needed)
Expand Down Expand Up @@ -48,6 +48,25 @@ Function Clean-Build-Environment
New-Item -Path $DeployPath -ItemType Directory
}

# For sourceforge links we need to get the correct mirror (especially NISIS) Thanks: https://www.powershellmagazine.com/2013/01/29/pstip-retrieve-a-redirected-url/
Function Get-RedirectedUrl {

Param (
[Parameter(Mandatory=$true)]
[String]$URL
)

$request = [System.Net.WebRequest]::Create($url)
$request.AllowAutoRedirect=$false
$response=$request.GetResponse()

if ($response.StatusCode -eq "Found")
{
$response.GetResponseHeader("Location")
}
}


# Download and uncompress dependency in ZIP format
Function Install-Dependency
{
Expand All @@ -65,6 +84,11 @@ Function Install-Dependency
$TempFileName = [System.IO.Path]::GetTempFileName() + ".zip"
$TempDir = [System.IO.Path]::GetTempPath()

if ($Uri -Match "sourceforge")
{
$Uri = Get-RedirectedUrl -URL $Uri
}

Invoke-WebRequest -Uri $Uri -OutFile $TempFileName
echo $TempFileName
Expand-Archive -Path $TempFileName -DestinationPath $TempDir -Force
Expand Down