Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ZipNames = @(
- "gong_libretro.dll.zip",
- "squirreljme_libretro.dll.zip",
- "potator_libretro.dll.zip",
- "freeintv_libretro.dll.zip"
- )
- $CoreDest = "${PSScriptRoot}\cores\"
- $CoresBaseUri = "https://buildbot.libretro.com/nightly/windows/x86_64/latest/"
- $LogDest = "${PSScriptRoot}\core_update.log"
- try
- {
- Start-Transcript -Path $LogDest -UseMinimalHeader
- }
- catch [System.Management.Automation.ParameterBindingException]
- {
- Start-Transcript -Path $LogDest
- }
- foreach ($zip in $ZipNames)
- {
- $dll = $zip -replace '\.zip$', ''
- $params = @{
- "LiteralPath" = (Join-Path $CoreDest $dll)
- "ErrorAction" = "SilentlyContinue"
- }
- if (($creationTime = (Get-Item @params).CreationTime) -and
- (New-TimeSpan $creationTime (Get-Date)).Days -lt 7)
- {
- Write-Host "Skipping core ${dll}: It's not older than a week."
- continue
- }
- $params = @{
- "Uri" = ($CoresBaseUri + $zip)
- "OutFile" = ($CoreDest + $zip)
- "Verbose" = $true
- }
- try
- {
- Invoke-WebRequest @params
- }
- catch
- {
- Write-Host "Skipping core ${dll}: Failed to download ${zip}."
- continue
- }
- $params = @{
- "LiteralPath" = ($CoreDest + $zip)
- "DestinationPath" = $CoreDest
- "Force" = $true
- "Verbose" = $true
- }
- Expand-Archive @params
- Remove-Item ($CoreDest + $zip) -Verbose
- }
- Stop-Transcript
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement