From b89233753ac69ce4d8f5ef52a7aba195666c77f6 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Thu, 3 Oct 2024 14:21:08 +0100 Subject: [PATCH] [Settings]Fix crash showing non-existent template folder --- .../ViewModels/NewPlusViewModel.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs index cab1a9df77..1a92af09da 100644 --- a/src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs @@ -250,12 +250,21 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private void OpenNewTemplateFolder() { - var process = new ProcessStartInfo() + try { - FileName = _templateLocation, - UseShellExecute = true, - }; - Process.Start(process); + CopyTemplateExamples(_templateLocation); + + var process = new ProcessStartInfo() + { + FileName = _templateLocation, + UseShellExecute = true, + }; + Process.Start(process); + } + catch (Exception ex) + { + Logger.LogError("Failed to show NewPlus template folder.", ex); + } } private async void PickNewTemplateFolder()