From 3b7f99b819e18407e33a874546b84118c80681c3 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Wed, 10 Sep 2025 15:42:02 +1000 Subject: [PATCH] update runtime scriptapp for powershell - fix 'list' subcommand to work before first ever 'fetch' --- bin/runtime.cmd | 10 +++++++--- src/scriptapps/runtime.ps1 | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bin/runtime.cmd b/bin/runtime.cmd index 6bac2995..167b4f1e 100755 --- a/bin/runtime.cmd +++ b/bin/runtime.cmd @@ -1931,7 +1931,7 @@ function psmain { $arch = "win32-x86_64" $archfolder = Join-Path -Path $rtfolder -ChildPath "$arch" if (-not(Test-Path -Path $archfolder -PathType Container)) { - write-host "No runtimes seem to be installed for win32-x86_64`nPlease use 'runtime.cmd fetch' to install" + write-host "No runtimes seem to be installed for $arch`nPlease use 'runtime.cmd fetch' to install" } else { $dircontents = (get-childItem -Path $archfolder -File | Sort-Object Name) if ($dircontents.Count -gt 0) { @@ -1973,7 +1973,7 @@ function psmain { } } else { write-host "No files found in $archfolder" - write-host "No runtimes seem to be installed for win32-x86_64`nPlease use 'runtime.cmd fetch' to install." + write-host "No runtimes seem to be installed for $arch`nPlease use 'runtime.cmd fetch' to install." } } } @@ -1985,6 +1985,9 @@ function psmain { $archurl = "$artifacturl/$arch" $sha1url = "$archurl/sha1sums.txt" if ( $PSBoundParameters.ContainsKey('remote') ) { + if (-not (test-path -Path $archfolder -Type Container)) { + new-item -Path $container -ItemType Directory -force #create with intermediary folders if not already present + } write-host "Checking for available remote runtimes for" Write-Host "Fetching $sha1url" Invoke-WebRequest -Uri $sha1url -OutFile $sha1local -ErrorAction Stop @@ -2065,7 +2068,8 @@ function psmain { Write-host "-----------------------------------------------------------------------" Write-host "Use: 'list -remote' to compare local runtimes with those available on the artifact server" } else { - write-host "No runtimes seem to be installed for win32-x86_64 in $archfolder`nPlease use 'runtime.cmd fetch' to install." + write-host "No runtimes seem to be installed for $arch in $archfolder`nPlease use 'runtime.cmd fetch' to install." + write-host "Use 'runtime.cmd list -remote' to see available runtimes for $arch" } } } diff --git a/src/scriptapps/runtime.ps1 b/src/scriptapps/runtime.ps1 index 87c00e17..e147e9f4 100644 --- a/src/scriptapps/runtime.ps1 +++ b/src/scriptapps/runtime.ps1 @@ -252,7 +252,7 @@ function psmain { $arch = "win32-x86_64" $archfolder = Join-Path -Path $rtfolder -ChildPath "$arch" if (-not(Test-Path -Path $archfolder -PathType Container)) { - write-host "No runtimes seem to be installed for win32-x86_64`nPlease use 'runtime.cmd fetch' to install" + write-host "No runtimes seem to be installed for $arch`nPlease use 'runtime.cmd fetch' to install" } else { $dircontents = (get-childItem -Path $archfolder -File | Sort-Object Name) if ($dircontents.Count -gt 0) { @@ -294,7 +294,7 @@ function psmain { } } else { write-host "No files found in $archfolder" - write-host "No runtimes seem to be installed for win32-x86_64`nPlease use 'runtime.cmd fetch' to install." + write-host "No runtimes seem to be installed for $arch`nPlease use 'runtime.cmd fetch' to install." } } } @@ -306,6 +306,9 @@ function psmain { $archurl = "$artifacturl/$arch" $sha1url = "$archurl/sha1sums.txt" if ( $PSBoundParameters.ContainsKey('remote') ) { + if (-not (test-path -Path $archfolder -Type Container)) { + new-item -Path $container -ItemType Directory -force #create with intermediary folders if not already present + } write-host "Checking for available remote runtimes for" Write-Host "Fetching $sha1url" Invoke-WebRequest -Uri $sha1url -OutFile $sha1local -ErrorAction Stop @@ -386,7 +389,8 @@ function psmain { Write-host "-----------------------------------------------------------------------" Write-host "Use: 'list -remote' to compare local runtimes with those available on the artifact server" } else { - write-host "No runtimes seem to be installed for win32-x86_64 in $archfolder`nPlease use 'runtime.cmd fetch' to install." + write-host "No runtimes seem to be installed for $arch in $archfolder`nPlease use 'runtime.cmd fetch' to install." + write-host "Use 'runtime.cmd list -remote' to see available runtimes for $arch" } } }