Ensure profile files can be created

This commit is contained in:
Manuel Thalmann 2023-07-27 02:32:31 +02:00
parent 00d349e162
commit c71a8edcaf

View file

@ -47,13 +47,18 @@ class Context {
} }
$profileFiles | ForEach-Object { $profileFiles | ForEach-Object {
$dirName = Split-Path -Parent $_; $fileName = "C:\Users\Default\$_";
$dirName = Split-Path -Parent $fileName;
if (-not (Test-Path -PathType Container $dirName)) { if (-not (Test-Path -PathType Container $dirName)) {
New-Item -ItemType Directory $dirName; New-Item -ItemType Directory $dirName;
} }
Add-Content -Force "C:\Users\Default\$_" "`n$statement"; if (Test-Path -PathType Leaf $fileName) {
Add-Content -Force "$fileName" "`n$statement";
} else {
Set-Content -Force "$fileName" "$statement";
}
}; };
Pop-Location; Pop-Location;