Skip to content

Commit

Permalink
Support Eject for PS 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Jeffrey committed Jan 24, 2025
1 parent 2c24f5c commit 01dd1c0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion EmbroideryCollection-Cleanup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ function doWinForm() {
if ($script:InitJob) {
$script:InitJob = $false
$btn_go.Enabled = $false
# Slow operations
#Slow operations
updateDriveList
driveComboChange
$script:InfoText.Size = ""
Expand Down Expand Up @@ -1169,6 +1169,13 @@ function doWinForm() {
return $SetExiting
}

# bit of a Hack to get around the PS 5.1 issue with type compiling
if ($PSVersionTable.PSVersion.Major -lt 7 ) {
function FlushDrive(){
return $true
}
} else {

Add-Type @"
using System;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -1213,6 +1220,7 @@ public class myFlushFileBuffers
}
"@

}
function EjectUSB {

# Eject the USB drive
Expand Down

0 comments on commit 01dd1c0

Please sign in to comment.