Skip to content

Commit 91e7b1c

Browse files
committed
update IconPath handling of path
1 parent ee43152 commit 91e7b1c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Plugins/Flow.Launcher.Plugin.WebSearch/SearchSource.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
using JetBrains.Annotations;
44
using Newtonsoft.Json;
55
using Flow.Launcher.Infrastructure.Image;
6+
using Flow.Launcher.Infrastructure;
7+
using System.Reflection;
68

79
namespace Flow.Launcher.Plugin.WebSearch
810
{
911
public class SearchSource : BaseModel
1012
{
11-
public const string DefaultIcon = "web_search.png";
1213
public string Title { get; set; }
1314
public string ActionKeyword { get; set; }
1415

1516
[NotNull]
16-
public string Icon { get; set; } = DefaultIcon;
17+
public string Icon { get; set; } = "web_search.png";
18+
19+
private string iconPath;
1720

1821
/// <summary>
1922
/// Default icons are placed in Images directory in the app location.
@@ -25,7 +28,13 @@ public string IconPath
2528
get
2629
{
2730
if (string.IsNullOrEmpty(iconPath))
28-
return Path.Combine(Main.ImagesDirectory, Icon);
31+
{
32+
var pluginDirectorys = Directory.GetParent(Assembly.GetExecutingAssembly().Location.NonNull()).ToString();
33+
34+
var imagesDirectory = Path.Combine(pluginDirectorys, "Images");
35+
36+
return Path.Combine(imagesDirectory, Icon);
37+
}
2938

3039
return iconPath;
3140
}
@@ -35,8 +44,6 @@ public string IconPath
3544
}
3645
}
3746

38-
private string iconPath;
39-
4047
[JsonIgnore]
4148
public ImageSource Image => ImageLoader.Load(IconPath);
4249

@@ -51,6 +58,7 @@ public SearchSource DeepCopy()
5158
ActionKeyword = string.Copy(ActionKeyword),
5259
Url = string.Copy(Url),
5360
Icon = string.Copy(Icon),
61+
IconPath = string.Copy(IconPath),
5462
Enabled = Enabled
5563
};
5664
return webSearch;

0 commit comments

Comments
 (0)