From a1bc1734c0df34fdd7aaee3676f03c1b5e292752 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 27 Jul 2023 17:42:05 +0200 Subject: [PATCH] Prevent accessing an object multiple times at once --- scripts/Windows/Collections/Personal.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/Windows/Collections/Personal.ps1 b/scripts/Windows/Collections/Personal.ps1 index e0fa2e43..54d94a99 100644 --- a/scripts/Windows/Collections/Personal.ps1 +++ b/scripts/Windows/Collections/Personal.ps1 @@ -151,7 +151,9 @@ function Restore-PersonalApps([Context] $context) { @($PROFILE, (powershell -c '$PROFILE')) | ForEach-Object { Get-Item "$(Split-Path -Parent $_)/profile.d/*Oh My Posh*"; } | ForEach-Object { - Get-Content $_ | ForEach-Object { + $oldContent = Get-Content $_; + + $oldContent | ForEach-Object { $indicator = "oh-my-posh init"; $_ -replace $indicator,"$indicator --config ~/Nextcloud/.omp/manuel.omp.json"; } | Set-Content $_;