Add cleanup to download functions

This commit is contained in:
Matt Nadareski
2025-04-30 12:03:06 -04:00
parent 33ce0e4024
commit dc0675d8c6
3 changed files with 29 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
- Unify download maps
- Trailing commas caused issues
- Add initial extraction to new functions
- Add cleanup to download functions
### 3.3.0 (2025-01-03)

View File

@@ -156,10 +156,21 @@ function download_programs() {
done
done
done
}
#TEMP INVOCATION OF THE ABOVE
download_programs
# Clean up the downloaded files and directories
for PREFIX in "${DL_PREFIXES[@]}"; do
for RUNTIME in "${CHECK_RUNTIMES[@]}"; do
URL=${DL_MAP["$PREFIX_$RUNTIME"]}
if [ $URL = "" ]; then
continue
fi
EXT=${URL##*.}
rm $PREFIX_$RUNTIME.$EXT
rm -r $PREFIX_$RUNTIME-dir
done
done
}
# Only build if requested
if [ $NO_BUILD = false ]; then

View File

@@ -143,6 +143,20 @@ function Download-Programs {
}
}
}
# Clean up the downloaded files and directories
foreach ($PREFIX in $DL_PREFIXES) {
foreach ($RUNTIME in $CHECK_RUNTIMES) {
$URL = $DL_MAP["$PREFIX_$RUNTIME"]
if ( $URL -eq "" ) {
continue
}
$EXT=[System.IO.Path]::GetExtension($URL)
Remove-Item -Path $PREFIX_$RUNTIME.$EXT
Remove-Item -Path $PREFIX_$RUNTIME-dir -Recurse
}
}
}
# Only build if requested