From cd0401b2e1954a860ae8a8cfd7fe6ea1341ed42b Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 21 Mar 2024 00:10:54 +0100 Subject: [PATCH] Fix `PowerShell` config installation --- scripts/Common/Config/powershell/lib.ps1 | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/scripts/Common/Config/powershell/lib.ps1 b/scripts/Common/Config/powershell/lib.ps1 index b9df7fbe..2325468f 100644 --- a/scripts/Common/Config/powershell/lib.ps1 +++ b/scripts/Common/Config/powershell/lib.ps1 @@ -54,22 +54,9 @@ $null = New-Module { } Push-Location ~; - $profiles = $profiles | ForEach-Object { [System.IO.Path]::GetRelativePath($(Get-Location), $_); }; - - $profiles | ForEach-Object { - $fileName = "$HomeDir/$_"; - $dirName = Split-Path -Parent $fileName; - - if (-not (Test-Path -PathType Container $dirName)) { - $null = New-Item -ItemType Directory -Force $dirName; - } - - if ((Test-Path -PathType Leaf $fileName) -and (-not $Overwrite)) { - Add-Content -Force "$fileName" "`n$Statement"; - } else { - Set-Content -Force "$fileName" "$Statement"; - } - }; + $profiles = $profiles | + ForEach-Object { [System.IO.Path]::GetRelativePath($(Get-Location), $_); } | + ForEach-Object { "$HomeDir/$_" }; } if ($Category) { @@ -80,6 +67,20 @@ $null = New-Module { $profiles = $profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "conf.d" "$Category.ps1"; }; } + $profiles | ForEach-Object { + $dirName = Split-Path -Parent $fileName; + + if (-not (Test-Path -PathType Container $dirName)) { + $null = New-Item -ItemType Directory -Force $dirName; + } + + if ((Test-Path -PathType Leaf $fileName) -and (-not $Overwrite)) { + Add-Content -Force "$fileName" "`n$Statement"; + } else { + Set-Content -Force "$fileName" "$Statement"; + } + }; + Pop-Location; }