optimize helper

This commit is contained in:
Gleb Khmyznikov
2025-11-04 15:20:57 -08:00
parent d04f4bcd0a
commit c420df7cd4
2 changed files with 8 additions and 16 deletions

View File

@@ -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);
}
}
/// <summary>
/// Gets the path to the global PowerToys settings file.
/// </summary>
/// <returns>Full path to the settings.json file.</returns>
private static string GetGlobalSettingsPath()
{
string powerToysSettingsDirectory = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Microsoft",
"PowerToys");
return Path.Combine(powerToysSettingsDirectory, "settings.json");
}
}
}

View File

@@ -8,7 +8,7 @@
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<InvariantGlobalization>true</InvariantGlobalization>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>
@@ -21,4 +21,8 @@
<PackageReference Include="CoenM.ImageSharp.ImageHash" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
</ItemGroup>
</Project>