From c420df7cd4e4c100ffd641fed3bfde87a5aa4cae Mon Sep 17 00:00:00 2001 From: Gleb Khmyznikov Date: Tue, 4 Nov 2025 15:20:57 -0800 Subject: [PATCH] optimize helper --- .../UITestAutomation/SettingsConfigHelper.cs | 18 +++--------------- .../UITestAutomation/UITestAutomation.csproj | 6 +++++- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/common/UITestAutomation/SettingsConfigHelper.cs b/src/common/UITestAutomation/SettingsConfigHelper.cs index cd0a5e1a6d..12fe0527b8 100644 --- a/src/common/UITestAutomation/SettingsConfigHelper.cs +++ b/src/common/UITestAutomation/SettingsConfigHelper.cs @@ -9,6 +9,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Text.Json; +using Microsoft.PowerToys.Settings.UI.Library.Utilities; namespace Microsoft.PowerToys.UITest { @@ -33,7 +34,8 @@ namespace Microsoft.PowerToys.UITest try { - string globalSettingsPath = GetGlobalSettingsPath(); + string localAppData = Helper.LocalApplicationDataFolder(); + string globalSettingsPath = Path.Combine(localAppData, "Microsoft", "PowerToys", "settings.json"); if (!File.Exists(globalSettingsPath)) { @@ -87,19 +89,5 @@ namespace Microsoft.PowerToys.UITest throw new InvalidOperationException($"Failed to configure global module settings: {ex.Message}", ex); } } - - /// - /// Gets the path to the global PowerToys settings file. - /// - /// Full path to the settings.json file. - private static string GetGlobalSettingsPath() - { - string powerToysSettingsDirectory = Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), - "Microsoft", - "PowerToys"); - - return Path.Combine(powerToysSettingsDirectory, "settings.json"); - } } } diff --git a/src/common/UITestAutomation/UITestAutomation.csproj b/src/common/UITestAutomation/UITestAutomation.csproj index add7acfeb9..549b8a430b 100644 --- a/src/common/UITestAutomation/UITestAutomation.csproj +++ b/src/common/UITestAutomation/UITestAutomation.csproj @@ -8,7 +8,7 @@ enable true true - net9.0-windows10.0.22621.0 + net9.0-windows10.0.26100.0 true false @@ -21,4 +21,8 @@ + + + +