mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
Save relative path to settings (#11543)
This commit is contained in:
parent
3807673574
commit
cecf6fb089
@ -193,6 +193,12 @@ namespace PowerLauncher
|
|||||||
return results.Values.ToList();
|
return results.Values.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetIcon(PluginMetadata metadata, string iconPath)
|
||||||
|
{
|
||||||
|
var pluginDirectory = Path.GetFileName(metadata.PluginDirectory);
|
||||||
|
return Path.Combine(pluginDirectory, iconPath);
|
||||||
|
}
|
||||||
|
|
||||||
private static IEnumerable<PowerLauncherPluginSettings> GetDefaultPluginsSettings()
|
private static IEnumerable<PowerLauncherPluginSettings> GetDefaultPluginsSettings()
|
||||||
{
|
{
|
||||||
return PluginManager.AllPlugins.Select(x => new PowerLauncherPluginSettings()
|
return PluginManager.AllPlugins.Select(x => new PowerLauncherPluginSettings()
|
||||||
@ -204,8 +210,8 @@ namespace PowerLauncher
|
|||||||
Disabled = x.Metadata.Disabled,
|
Disabled = x.Metadata.Disabled,
|
||||||
IsGlobal = x.Metadata.IsGlobal,
|
IsGlobal = x.Metadata.IsGlobal,
|
||||||
ActionKeyword = x.Metadata.ActionKeyword,
|
ActionKeyword = x.Metadata.ActionKeyword,
|
||||||
IconPathDark = x.Metadata.IcoPathDark,
|
IconPathDark = GetIcon(x.Metadata, x.Metadata.IcoPathDark),
|
||||||
IconPathLight = x.Metadata.IcoPathLight,
|
IconPathLight = GetIcon(x.Metadata, x.Metadata.IcoPathLight),
|
||||||
AdditionalOptions = x.Plugin is ISettingProvider ? (x.Plugin as ISettingProvider).AdditionalOptions : new List<PluginAdditionalOption>(),
|
AdditionalOptions = x.Plugin is ISettingProvider ? (x.Plugin as ISettingProvider).AdditionalOptions : new List<PluginAdditionalOption>(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,6 @@ namespace Wox.Plugin
|
|||||||
{
|
{
|
||||||
_pluginDirectory = value;
|
_pluginDirectory = value;
|
||||||
ExecuteFilePath = Path.Combine(value, ExecuteFileName);
|
ExecuteFilePath = Path.Combine(value, ExecuteFileName);
|
||||||
IcoPathDark = Path.Combine(value, IcoPathDark);
|
|
||||||
IcoPathLight = Path.Combine(value, IcoPathLight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
@ -128,7 +129,15 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
return $"{Name}. {Description}";
|
return $"{Name}. {Description}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string IconPath { get => isDark() ? settings.IconPathDark : settings.IconPathLight; }
|
public string IconPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var path = isDark() ? settings.IconPathDark : settings.IconPathLight;
|
||||||
|
path = Path.Combine(Directory.GetCurrentDirectory(), @"modules\launcher\Plugins", path);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool _showAdditionalInfoPanel;
|
private bool _showAdditionalInfoPanel;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user