Skip to content

Commit

Permalink
[Fix]: MicroWin finds but fails to use system oscdimg (#1298)
Browse files Browse the repository at this point in the history
* Update winutil.ps1 (#1295)

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

* Compiled change b740693

---------

Co-authored-by: Chris Titus <[email protected]>
  • Loading branch information
ty802 and ChrisTitusTech authored Dec 20, 2023
1 parent c8b56d5 commit 316df45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions functions/public/Invoke-WPFGetIso.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ function Invoke-WPFGetIso {
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"

$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf

if (!$oscdImgFound)
{
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
Expand All @@ -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
# 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
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
Write-Host "choco on system: $chocoFound"
Expand All @@ -47,6 +45,7 @@ function Invoke-WPFGetIso {
return
}
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
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
if (!$oscdImgFound) {
Expand Down
9 changes: 4 additions & 5 deletions winutil.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2313,12 +2313,10 @@ function Invoke-WPFGetIso {
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"

$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf

if (!$oscdImgFound)
{
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
Expand All @@ -2327,7 +2325,7 @@ function Invoke-WPFGetIso {
{
# 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
[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
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
Write-Host "choco on system: $chocoFound"
Expand All @@ -2342,6 +2340,7 @@ function Invoke-WPFGetIso {
return
}
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
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
if (!$oscdImgFound) {
Expand Down

0 comments on commit 316df45

Please sign in to comment.