Fix PowerShell
config installation
This commit is contained in:
parent
9918465b27
commit
a4535eaf05
|
@ -54,22 +54,9 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
Push-Location ~;
|
Push-Location ~;
|
||||||
$profiles = $profiles | ForEach-Object { [System.IO.Path]::GetRelativePath($(Get-Location), $_); };
|
$profiles = $profiles |
|
||||||
|
ForEach-Object { [System.IO.Path]::GetRelativePath($(Get-Location), $_); } |
|
||||||
$profiles | ForEach-Object {
|
ForEach-Object { "$HomeDir/$_" };
|
||||||
$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";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Category) {
|
if ($Category) {
|
||||||
|
@ -80,6 +67,20 @@ $null = New-Module {
|
||||||
$profiles = $profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "conf.d" "$Category.ps1"; };
|
$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;
|
Pop-Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue