From e6ab6f88621dfe710b96c2a06a2ca054a0fa9770 Mon Sep 17 00:00:00 2001 From: Andrei Hutanu Date: Sun, 10 Dec 2023 14:48:11 +0100 Subject: [PATCH] hotfix sw folder intro --- scrcpy.nuspec | 2 +- tools/chocolateyinstall.ps1 | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/scrcpy.nuspec b/scrcpy.nuspec index 8372ef7..a35d3e5 100755 --- a/scrcpy.nuspec +++ b/scrcpy.nuspec @@ -3,7 +3,7 @@ scrcpy - 2.2 + 2.2.0.20231210 https://github.com/n3rd4i/scrcpy.git n3rd4i diff --git a/tools/chocolateyinstall.ps1 b/tools/chocolateyinstall.ps1 index 87dd285..f6fbb86 100755 --- a/tools/chocolateyinstall.ps1 +++ b/tools/chocolateyinstall.ps1 @@ -2,14 +2,36 @@ $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" . "$(Join-Path $toolsDir commonEnv.ps1)" +$url = 'https://github.com/Genymobile/scrcpy/releases/download/v2.2/scrcpy-win64-v2.2.zip' +$folderName = $(Split-Path $url -leaf).replace('.zip', '') + +# 1. Download bundle $packageArgs = @{ packageName = $env:ChocolateyPackageName - unzipLocation = $toolsDir - url = 'https://github.com/Genymobile/scrcpy/releases/download/v2.2/scrcpy-win64-v2.2.zip' + fileFullPath = "$(Join-Path $ENV:TEMP 'scrcpy.zip')" + url = $url checksum = '9F9DA88AC4C8319DCB9BF852F2D9BBA942BAC663413383419CDDF64EAA5685BD' checksumType = 'sha256' } -Install-ChocolateyZipPackage @packageArgs +$archivePath = Get-ChocolateyWebFile @packageArgs + +# 2. Extract bundle in $ENV:TEMP +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + unzipLocation = $ENV:TEMP + fileFullPath = $archivePath +} +$extractedFolder = Get-ChocolateyUnzip @packageArgs +Remove-Item -Path $archivePath + +$sourceFolder = Join-Path -Path $extractedFolder -ChildPath $folderName +if (Test-Path -Path $installLocation) { + # if we get here the emacs folder exists so we need to copy the files into it + Copy-Item -Path "$sourceFolder\*.*" -Destination $installLocation -Recurse -Force + + # once we have copied all of the files out of it, remove the folder as we no longer need it + Remove-Item -Path $sourceFolder -Recurse -Force +} $pp = Get-PackageParameters if ($pp['ExcludeADB'] -eq 'true') {