mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
optimize helper
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user