Browse Source

update runtime scriptapp for powershell - fix 'list' subcommand to work before first ever 'fetch'

master
Julian Noble 1 week ago
parent
commit
3b7f99b819
  1. 10
      bin/runtime.cmd
  2. 10
      src/scriptapps/runtime.ps1

10
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"
}
}
}

10
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"
}
}
}

Loading…
Cancel
Save