3
3
using JetBrains . Annotations ;
4
4
using Newtonsoft . Json ;
5
5
using Flow . Launcher . Infrastructure . Image ;
6
+ using Flow . Launcher . Infrastructure ;
7
+ using System . Reflection ;
6
8
7
9
namespace Flow . Launcher . Plugin . WebSearch
8
10
{
9
11
public class SearchSource : BaseModel
10
12
{
11
- public const string DefaultIcon = "web_search.png" ;
12
13
public string Title { get ; set ; }
13
14
public string ActionKeyword { get ; set ; }
14
15
15
16
[ NotNull ]
16
- public string Icon { get ; set ; } = DefaultIcon ;
17
+ public string Icon { get ; set ; } = "web_search.png" ;
18
+
19
+ private string iconPath ;
17
20
18
21
/// <summary>
19
22
/// Default icons are placed in Images directory in the app location.
@@ -25,7 +28,13 @@ public string IconPath
25
28
get
26
29
{
27
30
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
+ }
29
38
30
39
return iconPath ;
31
40
}
@@ -35,8 +44,6 @@ public string IconPath
35
44
}
36
45
}
37
46
38
- private string iconPath ;
39
-
40
47
[ JsonIgnore ]
41
48
public ImageSource Image => ImageLoader . Load ( IconPath ) ;
42
49
@@ -51,6 +58,7 @@ public SearchSource DeepCopy()
51
58
ActionKeyword = string . Copy ( ActionKeyword ) ,
52
59
Url = string . Copy ( Url ) ,
53
60
Icon = string . Copy ( Icon ) ,
61
+ IconPath = string . Copy ( IconPath ) ,
54
62
Enabled = Enabled
55
63
} ;
56
64
return webSearch ;
0 commit comments