fix Constant.PythonPath not being set when python path is already specified.

This commit is contained in:
Hongtao Zhang 2022-12-17 19:25:56 -06:00
parent 61aaa0129d
commit d96f515944
No known key found for this signature in database
GPG key ID: 75F655B91C7AC9BB

View file

@ -83,7 +83,10 @@ namespace Flow.Launcher.Core.Plugin
return;
}
plugins.Add(new PluginPair {Plugin = plugin, Metadata = metadata});
plugins.Add(new PluginPair
{
Plugin = plugin, Metadata = metadata
});
});
metadata.InitTime += milliseconds;
}
@ -114,10 +117,12 @@ namespace Flow.Launcher.Core.Plugin
return new List<PluginPair>();
if (!string.IsNullOrEmpty(settings.PythonDirectory) && FilesFolders.LocationExists(settings.PythonDirectory))
{
Constant.PythonPath = settings.PythonDirectory;
return SetPythonPathForPluginPairs(source, Path.Combine(settings.PythonDirectory, PythonExecutable));
}
var pythonPath = string.Empty;
if (MessageBox.Show("Flow detected you have installed Python plugins, which " +
"will need Python to run. Would you like to download Python? " +
Environment.NewLine + Environment.NewLine +
@ -186,16 +191,15 @@ namespace Flow.Launcher.Core.Plugin
}
private static IEnumerable<PluginPair> SetPythonPathForPluginPairs(List<PluginMetadata> source, string pythonPath)
=> source
=> source
.Where(o => o.Language.ToUpper() == AllowedLanguage.Python)
.Select(metadata => new PluginPair
{
Plugin = new PythonPlugin(pythonPath),
Metadata = metadata
Plugin = new PythonPlugin(pythonPath), Metadata = metadata
})
.ToList();
public static IEnumerable<PluginPair> ExecutablePlugins(IEnumerable<PluginMetadata> source)
public static IEnumerable<PluginPair> ExecutablePlugins(IEnumerable<PluginMetadata> source)
{
return source
.Where(o => o.Language.ToUpper() == AllowedLanguage.Executable)