diff --git a/CHANGELIST.md b/CHANGELIST.md index d7886705..76a5959e 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -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) diff --git a/publish-nix.sh b/publish-nix.sh index 6fd838be..418ee52f 100755 --- a/publish-nix.sh +++ b/publish-nix.sh @@ -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 diff --git a/publish-win.ps1 b/publish-win.ps1 index 5ff608b8..e1ff3cf3 100644 --- a/publish-win.ps1 +++ b/publish-win.ps1 @@ -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