mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-24 04:12:32 +08:00
[FindMyMouse]Fix duplicated settings path (#14584)
This commit is contained in:
parent
2d5276f742
commit
641d838140
@ -9,7 +9,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class FindMyMouseSettings : BasePTModuleSettings, ISettingsConfig
|
||||
{
|
||||
public const string ModuleName = "Find My Mouse";
|
||||
public const string ModuleName = "FindMyMouse";
|
||||
|
||||
[JsonPropertyName("properties")]
|
||||
public FindMyMouseProperties Properties { get; set; }
|
||||
|
@ -14,6 +14,24 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
|
||||
public MouseUtilsPage()
|
||||
{
|
||||
try
|
||||
{
|
||||
// By mistake, the first release of Find My Mouse was saving settings in two places at the same time.
|
||||
// Delete the wrong path for Find My Mouse settings.
|
||||
var tempSettingsUtils = new SettingsUtils();
|
||||
if (tempSettingsUtils.SettingsExists("Find My Mouse"))
|
||||
{
|
||||
var settingsFilePath = tempSettingsUtils.GetSettingsFilePath("Find My Mouse");
|
||||
System.IO.File.Delete(settingsFilePath);
|
||||
tempSettingsUtils.DeleteSettings("Find My Mouse");
|
||||
}
|
||||
}
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
catch (System.Exception)
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
{
|
||||
}
|
||||
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new MouseUtilsViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<FindMyMouseSettings>.GetInstance(settingsUtils), SettingsRepository<MouseHighlighterSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
|
Loading…
Reference in New Issue
Block a user