# Between Ridges -- the Windows installer. # # Run from PowerShell with # # irm https://daily.dataswizzles.com/install.ps1 | iex # # Downloads the current playtest build, unpacks it into Games\BetweenRidges in your user folder, # puts a shortcut in the Start Menu and on the Desktop, and launches the game. Run it again any # time to update; your saves and settings live elsewhere (AppData) and are never touched. # # Why a script and not a download link: Windows shows "Windows protected your PC" for any # unsigned program that a *browser* downloaded. This fetches the build with curl instead, which # leaves no such mark, so the game opens with no warning at all. The build is exactly the same # file as the zip at https://daily.dataswizzles.com/windows. # # Everything below runs inside one script block so nothing it sets leaks into your session. & { $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' # the progress bar makes PowerShell 5 downloads crawl $archive = 'https://daily.dataswizzles.com/windows' $folder = 'Between-Ridges-Playtest' $exe = 'Between-Ridges-Playtest.exe' # $env:TEMP is the one directory certain to exist; ~\Downloads is not on a machine where # OneDrive has moved the user's folders. Every path is quoted because $HOME routinely has a # space in it. $zip = Join-Path $env:TEMP 'BetweenRidges.zip' $games = Join-Path $HOME 'Games\BetweenRidges' $game = Join-Path $games $folder $start = Join-Path $game $exe Write-Host '' Write-Host ' BETWEEN RIDGES' -ForegroundColor Yellow Write-Host ' downloading the current build (about 100 MB) ...' # curl.exe ships with Windows 10 1803 and later and attaches no Mark of the Web. On anything # older, fall back to PowerShell's own downloader and strip the mark it leaves. if (Get-Command curl.exe -ErrorAction SilentlyContinue) { & curl.exe -fL -# $archive -o $zip if ($LASTEXITCODE -ne 0) { throw "the download failed (curl exit code $LASTEXITCODE)" } } else { Invoke-WebRequest -Uri $archive -OutFile $zip -UseBasicParsing Unblock-File $zip } Write-Host " unpacking into $games ..." try { Expand-Archive -Force $zip $games } catch { if (Get-Process -Name ($exe -replace '\.exe$') -ErrorAction SilentlyContinue) { throw 'the game is running -- close it, then run this line again' } throw } Remove-Item $zip -ErrorAction SilentlyContinue if (-not (Test-Path $start)) { throw "the build unpacked but $exe is not where it should be ($game)" } # A shortcut where people look for programs: the Start Menu, and the Desktop. Both resolved # through the shell so they land in the right place when OneDrive owns the Desktop. $shell = New-Object -ComObject WScript.Shell foreach ($place in @([Environment]::GetFolderPath('Programs'), [Environment]::GetFolderPath('Desktop'))) { if (-not $place) { continue } $link = $shell.CreateShortcut((Join-Path $place 'Between Ridges.lnk')) $link.TargetPath = $start $link.WorkingDirectory = $game $link.IconLocation = "$start,0" $link.Description = 'Between Ridges (playtest)' $link.Save() } $version = (Get-Item $start).VersionInfo.ProductVersion Write-Host '' if ($version) { Write-Host " Installed v$version." -ForegroundColor Green } else { Write-Host ' Installed.' -ForegroundColor Green } Write-Host ' From now on: press Win, type "Between Ridges", Enter -- or use the Desktop shortcut.' Write-Host ' To update, run this same line again. To uninstall, delete the folder and the two shortcuts.' Write-Host '' # -WorkingDirectory so the game starts beside its own .pck whatever directory the paste happened in. Start-Process -WorkingDirectory $game $start }