From 17ad60b7ced5937e022ee2d265a93f412c3e5986 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Wed, 18 Jan 2023 01:07:32 +0100 Subject: [PATCH] Variable Name Change --- Winget-AutoUpdate/mods/_AppID-template.ps1 | 8 ++++---- Winget-AutoUpdate/mods/_Mods-Functions.ps1 | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Winget-AutoUpdate/mods/_AppID-template.ps1 b/Winget-AutoUpdate/mods/_AppID-template.ps1 index bec1128..4f9039d 100644 --- a/Winget-AutoUpdate/mods/_AppID-template.ps1 +++ b/Winget-AutoUpdate/mods/_AppID-template.ps1 @@ -46,10 +46,10 @@ $CopyTo = "" #Find/Replace text in file #Example: -#$ModsFile = "C:\dummy.txt" +#$File = "C:\dummy.txt" #$FindText = "brown fox" #$ReplaceText = "white fox" -$ModsFile = "" +$File = "" $FindText = "" $ReplaceText = "" @@ -87,8 +87,8 @@ if ($DelFile) { if ($CopyFile -and $CopyTo) { Copy-ModsFile $CopyFile $CopyTo } -if ($ModsFile -and $FindText -and $ReplaceText) { - Edit-ModsFile $ModsFile $FindText $ReplaceText +if ($File -and $FindText -and $ReplaceText) { + Edit-ModsFile $File $FindText $ReplaceText } if ($GrantPath) { Grant-ModsPath $GrantPath diff --git a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 index 51c8006..c04d754 100644 --- a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 +++ b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 @@ -192,9 +192,9 @@ function Copy-ModsFile ($CopyFile, $CopyTo) { Return } -function Edit-ModsFile ($ModsFile, $FindText, $ReplaceText) { - if (Test-Path "$ModsFile") { - ((Get-Content -path $ModsFile -Raw) -replace "$FindText","$ReplaceText") | Set-Content -Path $ModsFile -Force -ErrorAction SilentlyContinue | Out-Null +function Edit-ModsFile ($File, $FindText, $ReplaceText) { + if (Test-Path "$File") { + ((Get-Content -path $File -Raw) -replace "$FindText","$ReplaceText") | Set-Content -Path $File -Force -ErrorAction SilentlyContinue | Out-Null } Return }