mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
update IconPath handling of path
This commit is contained in:
parent
ee43152de1
commit
91e7b1cfb8
1 changed files with 13 additions and 5 deletions
|
|
@ -3,17 +3,20 @@ using System.Windows.Media;
|
|||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
using Flow.Launcher.Infrastructure.Image;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Flow.Launcher.Plugin.WebSearch
|
||||
{
|
||||
public class SearchSource : BaseModel
|
||||
{
|
||||
public const string DefaultIcon = "web_search.png";
|
||||
public string Title { get; set; }
|
||||
public string ActionKeyword { get; set; }
|
||||
|
||||
[NotNull]
|
||||
public string Icon { get; set; } = DefaultIcon;
|
||||
public string Icon { get; set; } = "web_search.png";
|
||||
|
||||
private string iconPath;
|
||||
|
||||
/// <summary>
|
||||
/// Default icons are placed in Images directory in the app location.
|
||||
|
|
@ -25,7 +28,13 @@ namespace Flow.Launcher.Plugin.WebSearch
|
|||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(iconPath))
|
||||
return Path.Combine(Main.ImagesDirectory, Icon);
|
||||
{
|
||||
var pluginDirectorys = Directory.GetParent(Assembly.GetExecutingAssembly().Location.NonNull()).ToString();
|
||||
|
||||
var imagesDirectory = Path.Combine(pluginDirectorys, "Images");
|
||||
|
||||
return Path.Combine(imagesDirectory, Icon);
|
||||
}
|
||||
|
||||
return iconPath;
|
||||
}
|
||||
|
|
@ -35,8 +44,6 @@ namespace Flow.Launcher.Plugin.WebSearch
|
|||
}
|
||||
}
|
||||
|
||||
private string iconPath;
|
||||
|
||||
[JsonIgnore]
|
||||
public ImageSource Image => ImageLoader.Load(IconPath);
|
||||
|
||||
|
|
@ -51,6 +58,7 @@ namespace Flow.Launcher.Plugin.WebSearch
|
|||
ActionKeyword = string.Copy(ActionKeyword),
|
||||
Url = string.Copy(Url),
|
||||
Icon = string.Copy(Icon),
|
||||
IconPath = string.Copy(IconPath),
|
||||
Enabled = Enabled
|
||||
};
|
||||
return webSearch;
|
||||
|
|
|
|||
Loading…
Reference in a new issue