Skip to content

Commit 54d3ebe

Browse files
authored
Update prepare.ps1
1 parent 2ace46d commit 54d3ebe

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

prepare.ps1

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,25 @@ function GithubReleaseFiles {
7474

7575
}
7676

77-
function Expand-Archive([string]$Path, [string]$Destination) {
77+
function Expand-Archive([string]$Path, [string]$Destination, [bool]$VerboseLogging = $false) {
7878
$7z_Application = "C:\Program Files\7-Zip\7z.exe"
7979
$7z_Arguments = @(
80-
'x' ## eXtract files with full paths
81-
'-y' ## assume Yes on all queries
82-
"`"-o$($Destination)`"" ## set Output directory
83-
"`"$($Path)`"" ## <archive_name>
80+
'x', # eXtract files with full paths
81+
'-y', # assume Yes on all queries
82+
"`"-o$($Destination)`"", # set Output directory
83+
"`"$($Path)`"" # <archive_name>
8484
)
85-
& $7z_Application $7z_Arguments | Out-Null
85+
86+
Write-Output "Extracting file: $Path to destination: $Destination"
87+
88+
if ($VerboseLogging) {
89+
& $7z_Application $7z_Arguments
90+
if ($LASTEXITCODE -ne 0) {
91+
throw "7-Zip exited with code $LASTEXITCODE"
92+
}
93+
} else {
94+
& $7z_Application $7z_Arguments | Out-Null
95+
}
8696
}
8797

8898
# Get script path
@@ -154,7 +164,7 @@ $coresPath = "$retroArchPath\cores"
154164
$retroArchBinary = "$requirementsFolder\RetroArch.7z"
155165
if(Test-Path $retroArchBinary){
156166
New-Item -ItemType Directory -Force -Path $retroArchPath
157-
Expand-Archive -Path $retroArchBinary -Destination . -Verbose
167+
Expand-Archive -Path $retroArchBinary -Destination . -VerboseLogging $true
158168
# TO-DO - add an Out-Null when this has been tested
159169
Copy-Item -Path RetroArch-Win64\* -Destination $retroArchPath -recurse -Force
160170
# New path - $retroArchPath\RetroArch-Win64

0 commit comments

Comments
 (0)