diff --git a/scripts/Windows/Scripts/AppAssociations.ps1 b/scripts/Windows/Scripts/AppAssociations.ps1 index 972ee86f..facaaa12 100644 --- a/scripts/Windows/Scripts/AppAssociations.ps1 +++ b/scripts/Windows/Scripts/AppAssociations.ps1 @@ -28,10 +28,17 @@ $null = New-Module { $association.ProgId = $progId; $association.ApplicationName = $applicationName; + [AppAssociations]::SaveAssociations($associations); + } + + static SaveAssociations([xml] $associations) { + $defaultAssociations = $associations.SelectNodes([AppAssociations]::associationSelector); + $defaultAssociations | ForEach-Object { $associations.RemoveChild($_); } | Sort-Object -Property "Identifier" | ForEach-Object { $associations.AppendChild($_); }; $configFile = New-TemporaryFile; $writerSettings = [System.Xml.XmlWriterSettings]::new(); $writerSettings.Indent = $true; + $writerSettings.IndentChars = " "; $writerSettings.Encoding = [System.Text.UTF8Encoding]::new(); $writer = [System.Xml.XmlWriter]::Create($configFile.FullName, $writerSettings); $associations.Save($writer);