Only convert relative paths if its a valid path

This commit is contained in:
Garulf 2022-10-07 10:47:49 -04:00 committed by Hongtao Zhang
parent ec1a06108d
commit ebd6f177a9

View file

@ -134,13 +134,16 @@ namespace Flow.Launcher.Plugin
get { return _pluginDirectory; }
set
{
Uri uriResult;
bool IsUriScheme = Uri.TryCreate(IcoPath, UriKind.Absolute, out uriResult)
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
_pluginDirectory = value;
if (!string.IsNullOrEmpty(IcoPath) && !Path.IsPathRooted(IcoPath) && !IsUriScheme)
if (!string.IsNullOrEmpty(IcoPath) && !Path.IsPathRooted(IcoPath))
{
IcoPath = Path.Combine(value, IcoPath);
string absPath = Path.Combine(value, IcoPath);
// Only convert relative paths if its a valid path
if (File.Exists(absPath))
{
IcoPath = absPath;
}
}
}
}