diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1 index 00fc126b..049deb3d 100644 --- a/scripts/Windows/Scripts/Context.ps1 +++ b/scripts/Windows/Scripts/Context.ps1 @@ -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; }