1+ # Use the folder where the script is located
2+ $folder = Split-Path - Parent $MyInvocation.MyCommand.Definition
3+ Set-Location $folder
4+
5+ # Base URL for downloads
6+ $baseUrl = " https://github.com/Brandon-T/Reflection/releases/download/autobuild/"
7+
8+ # Define the rename mappings
9+ $renameMap = @ {
10+ " libRemoteInput-i686.dll" = " libremoteinput32.dll"
11+ " libRemoteInput-x86_64.dll" = " libremoteinput64.dll"
12+ " libRemoteInput-x86_64.dylib" = " libremoteinput64.dylib"
13+ " libRemoteInput-aarch64.dylib" = " libremoteinput64.dylib.aarch64"
14+ " libRemoteInput-x86_64.so" = " libremoteinput64.so"
15+ " libRemoteInput-aarch64.so" = " libremoteinput64.so.aarch64"
16+ }
17+
18+ # Download and rename each file
19+ foreach ($oldName in $renameMap.Keys ) {
20+ $newName = $renameMap [$oldName ]
21+ $url = " $baseUrl$oldName "
22+ $downloadPath = Join-Path $folder $oldName
23+ $targetPath = Join-Path $folder $newName
24+
25+ try {
26+ Write-Host " Downloading '$oldName ' from '$url '..."
27+ Invoke-WebRequest - Uri $url - OutFile $downloadPath - UseBasicParsing
28+
29+ if (Test-Path $targetPath ) {
30+ Remove-Item - Path $targetPath - Force
31+ Write-Host " Deleted existing file: $newName "
32+ }
33+
34+ Rename-Item - Path $downloadPath - NewName $newName
35+ Write-Host " Renamed '$oldName ' to '$newName '"
36+ } catch {
37+ Write-Warning " Failed to process '$oldName ': $_ "
38+ }
39+ }
0 commit comments