diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 2c9b8d4fd..0f118e36d 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -90,6 +90,34 @@ namespace Flow.Launcher.Plugin } } + /// + /// Returns the plugin directory relative IcoPath or URL. This path is useful for storage where the it needs + /// to be resistant to changes in plugin location from update or portable mode change. + /// + /// Must be a local file path. + /// This will be empty string if IcoPath is a URL, so must check for empty string during usage + public string IcoPathRelative + { + get => _icoPath; + set + { + // As a standard this property will handle prepping and converting to absolute local path for icon image processing + if (!string.IsNullOrEmpty(value) + && !string.IsNullOrEmpty(PluginDirectory) + && !Path.IsPathRooted(value) + && !value.StartsWith("http://", StringComparison.OrdinalIgnoreCase) + && !value.StartsWith("https://", StringComparison.OrdinalIgnoreCase) + && !value.StartsWith("data:image", StringComparison.OrdinalIgnoreCase)) + { + _icoPath = Path.Combine(PluginDirectory, value); + } + else + { + _icoPath = value; + } + } + } + /// /// The image to be displayed for the badge of the result. ///