Refactor manipulation of nextcloud sync file

This commit is contained in:
Manuel Thalmann 2023-07-03 00:47:21 +02:00
parent 20debdc1ac
commit 95e8ce6992

View file

@ -244,13 +244,24 @@ class Context {
$configName += "WithPlaceholders";
}
Add-Content $($this.GetNextcloudConfigFile()) `
-Value (
$accountSectionEntered = $false;
Get-Content $($this.GetNextcloudConfigFile()) | `
ForEach-Object {
if ($_ -eq "[Accounts]") {
$accountSectionEntered = $true;
}
if ($_ -eq "" -and $accountSectionEntered) {
[string]::Join(
"`n",
@(
"0\$configName\$folderID\localPath=$localPath",
"0\$configName\$folderID\targetPath=$targetPath")));
"0\$configName\$folderID\targetPath=$targetPath"));
}
$_;
} | Set-Content $this.GetNextcloudConfigFile();
Start-Process $nextcloudPath;
}