[Fix]: MicroWin finds but fails to use system oscdimg

This commit is contained in:
kian yamamoto 2023-12-19 17:19:17 -06:00 committed by GitHub
parent 3bb48564ef
commit b740693948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,12 +18,10 @@ function Invoke-WPFGetIso {
Write-Host "/ /\/\ \| || (__ | | | (_) | \ /\ / | || | | | " Write-Host "/ /\/\ \| || (__ | | | (_) | \ /\ / | || | | | "
Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| " Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) $oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
Write-Host "oscdimg.exe on system: $oscdImgFound" Write-Host "oscdimg.exe on system: $oscdImgFound"
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
if (!$oscdImgFound) if (!$oscdImgFound)
{ {
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked $downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
@ -32,7 +30,7 @@ function Invoke-WPFGetIso {
{ {
# only show the message to people who did check the box to download from github, if you check the box # only show the message to people who did check the box to download from github, if you check the box
# you consent to downloading it, no need to show extra dialogs # you consent to downloading it, no need to show extra dialogs
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco or github. This might take a long time.") [System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco. This might take a long time.")
# the step below needs choco to download oscdimg # the step below needs choco to download oscdimg
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco) $chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
Write-Host "choco on system: $chocoFound" Write-Host "choco on system: $chocoFound"
@ -47,6 +45,7 @@ function Invoke-WPFGetIso {
return return
} }
else { else {
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it from github. This might take a long time.")
Get-Oscdimg -oscdimgPath $oscdimgPath Get-Oscdimg -oscdimgPath $oscdimgPath
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf $oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
if (!$oscdImgFound) { if (!$oscdImgFound) {