Skip to content

Commit 5fa9800

Browse files
committed
Now unused variables deleted
1 parent a33ba76 commit 5fa9800

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

Sources/Winget-AutoUpdate/WAU-Settings-GUI.ps1

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ function Set-WAUConfig {
6363

6464
# Get current configuration to compare
6565
$currentConfig = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue
66-
$registryChanged = $false
67-
$shortcutsChanged = $false
6866

6967
# Only update registry values that have actually changed
7068
foreach ($key in $Settings.Keys) {
@@ -79,7 +77,6 @@ function Set-WAUConfig {
7977
# Compare current value with new value
8078
if ($currentValue -ne $newValue) {
8179
Set-ItemProperty -Path $regPath -Name $key -Value $newValue -Force
82-
$registryChanged = $true
8380
}
8481
}
8582

@@ -108,7 +105,6 @@ function Set-WAUConfig {
108105

109106
if ($currentStartMenuSetting -ne $newStartMenuSetting) {
110107
Set-ItemProperty -Path $regPath -Name 'WAU_StartMenuShortcut' -Value $newStartMenuSetting -Force
111-
$shortcutsChanged = $true
112108

113109
$shortcutDir = "${env:PROGRAMDATA}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate"
114110

@@ -142,7 +138,6 @@ function Set-WAUConfig {
142138

143139
if ($currentAppInstallerSetting -ne $newAppInstallerSetting) {
144140
Set-ItemProperty -Path $regPath -Name 'WAU_AppInstallerShortcut' -Value $newAppInstallerSetting -Force
145-
$shortcutsChanged = $true
146141

147142
$appInstallerShortcut = "${env:Public}\Desktop\WAU App Installer.lnk"
148143

@@ -164,7 +159,6 @@ function Set-WAUConfig {
164159

165160
if ($currentDesktopSetting -ne $newDesktopSetting) {
166161
Set-ItemProperty -Path $regPath -Name 'WAU_DesktopShortcut' -Value $newDesktopSetting -Force
167-
$shortcutsChanged = $true
168162

169163
$desktopShortcut = "${env:Public}\Desktop\Run WAU.lnk"
170164

@@ -185,7 +179,6 @@ function Set-WAUConfig {
185179
# Always create if it doesn't exist when schedule is disabled (regardless of desktop shortcut setting)
186180
if (-not (Test-Path $runWAUDesktopShortcut)) {
187181
Add-Shortcut $runWAUDesktopShortcut "${env:SystemRoot}\System32\conhost.exe" "$($currentConfig.InstallLocation)" "--headless powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"$($currentConfig.InstallLocation)User-Run.ps1`"" "$icon" "Winget AutoUpdate" "Normal"
188-
$shortcutsChanged = $true
189182
# Mirror shortcut creation to registry
190183
Set-ItemProperty -Path $regPath -Name 'WAU_DesktopShortcut' -Value 1 -Force
191184
}
@@ -195,7 +188,6 @@ function Set-WAUConfig {
195188
$runWAUDesktopShortcut = "${env:Public}\Desktop\Run WAU.lnk"
196189
if (Test-Path $runWAUDesktopShortcut) {
197190
Remove-Item -Path $runWAUDesktopShortcut -Force
198-
$shortcutsChanged = $true
199191
# Mirror shortcut removal to registry
200192
Set-ItemProperty -Path $regPath -Name 'WAU_DesktopShortcut' -Value 0 -Force
201193
}
@@ -206,15 +198,13 @@ function Set-WAUConfig {
206198
$settingsDesktopShortcut = "${env:Public}\Desktop\WAU Settings (Administrator).lnk"
207199
if (Test-Path $settingsDesktopShortcut) {
208200
Remove-Item -Path $settingsDesktopShortcut -Force
209-
$shortcutsChanged = $true
210201
}
211202

212203
# Also remove Run WAU desktop shortcut if Start Menu is created and Desktop shortcuts are disabled
213204
if ($Settings.ContainsKey('WAU_DesktopShortcut') -and $Settings['WAU_DesktopShortcut'] -eq 0) {
214205
$runWAUDesktopShortcut = "${env:Public}\Desktop\Run WAU.lnk"
215206
if (Test-Path $runWAUDesktopShortcut) {
216207
Remove-Item -Path $runWAUDesktopShortcut -Force
217-
$shortcutsChanged = $true
218208
# Mirror shortcut removal to registry
219209
Set-ItemProperty -Path $regPath -Name 'WAU_DesktopShortcut' -Value 0 -Force
220210
}
@@ -229,7 +219,6 @@ function Set-WAUConfig {
229219

230220
if ($currentDesktopSetting -ne $correctRegistryValue) {
231221
Set-ItemProperty -Path $regPath -Name 'WAU_DesktopShortcut' -Value $correctRegistryValue -Force
232-
$shortcutsChanged = $true
233222
}
234223

235224
return $true

0 commit comments

Comments
 (0)