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();
|
||||
}
|
||||
|
||||
private static string GetIcon(PluginMetadata metadata, string iconPath)
|
||||
{
|
||||
var pluginDirectory = Path.GetFileName(metadata.PluginDirectory);
|
||||
return Path.Combine(pluginDirectory, iconPath);
|
||||
}
|
||||
|
||||
private static IEnumerable<PowerLauncherPluginSettings> GetDefaultPluginsSettings()
|
||||
{
|
||||
return PluginManager.AllPlugins.Select(x => new PowerLauncherPluginSettings()
|
||||
|
@ -204,8 +210,8 @@ namespace PowerLauncher
|
|||
Disabled = x.Metadata.Disabled,
|
||||
IsGlobal = x.Metadata.IsGlobal,
|
||||
ActionKeyword = x.Metadata.ActionKeyword,
|
||||
IconPathDark = x.Metadata.IcoPathDark,
|
||||
IconPathLight = x.Metadata.IcoPathLight,
|
||||
IconPathDark = GetIcon(x.Metadata, x.Metadata.IcoPathDark),
|
||||
IconPathLight = GetIcon(x.Metadata, x.Metadata.IcoPathLight),
|
||||
AdditionalOptions = x.Plugin is ISettingProvider ? (x.Plugin as ISettingProvider).AdditionalOptions : new List<PluginAdditionalOption>(),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -51,8 +51,6 @@ namespace Wox.Plugin
|
|||
{
|
||||
_pluginDirectory = value;
|
||||
ExecuteFilePath = Path.Combine(value, ExecuteFileName);
|
||||
IcoPathDark = Path.Combine(value, IcoPathDark);
|
||||
IcoPathLight = Path.Combine(value, IcoPathLight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
@ -128,7 +129,15 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue