Skip to content

Commit c9b232a

Browse files
committed
remove automatic retrieval py path from PATH or via where.exe
1 parent 64f6c0f commit c9b232a

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ namespace Flow.Launcher.Core.Plugin
1818
{
1919
public static class PluginsLoader
2020
{
21-
public const string PATH = "PATH";
22-
public const string Python = "python";
2321
public const string PythonExecutable = "pythonw.exe";
2422

2523
public static List<PluginPair> Plugins(List<PluginMetadata> metadatas, PluginsSettings settings)
@@ -117,62 +115,6 @@ public static IEnumerable<PluginPair> PythonPlugins(List<PluginMetadata> source,
117115
if (!source.Any(o => o.Language.ToUpper() == AllowedLanguage.Python))
118116
return new List<PluginPair>();
119117

120-
// Try setting Constant.PythonPath first, either from
121-
// PATH or from the given pythonDirectory
122-
if (string.IsNullOrEmpty(settings.PythonDirectory))
123-
{
124-
var whereProcess = Process.Start(new ProcessStartInfo
125-
{
126-
FileName = "where.exe",
127-
Arguments = "pythonw",
128-
RedirectStandardOutput = true,
129-
CreateNoWindow = true,
130-
UseShellExecute = false
131-
});
132-
133-
var pythonPath = whereProcess?.StandardOutput.ReadToEnd().Trim();
134-
135-
if (!string.IsNullOrEmpty(pythonPath))
136-
{
137-
pythonPath = FilesFolders.GetPreviousExistingDirectory(FilesFolders.LocationExists, pythonPath);
138-
}
139-
140-
if (string.IsNullOrEmpty(pythonPath))
141-
{
142-
var paths = Environment.GetEnvironmentVariable(PATH);
143-
144-
pythonPath = paths?
145-
.Split(';')
146-
.FirstOrDefault(p => p.ToLower().Contains(Python));
147-
}
148-
149-
if (!string.IsNullOrEmpty(pythonPath))
150-
{
151-
Constant.PythonPath = Path.Combine(pythonPath, PythonExecutable);
152-
settings.PythonDirectory =
153-
FilesFolders.GetPreviousExistingDirectory(FilesFolders.LocationExists, Constant.PythonPath);
154-
}
155-
else
156-
{
157-
Log.Error("PluginsLoader",
158-
"Failed to set Python path despite the environment variable PATH is found",
159-
"PythonPlugins");
160-
}
161-
}
162-
else
163-
{
164-
var path = Path.Combine(settings.PythonDirectory, PythonExecutable);
165-
if (File.Exists(path))
166-
{
167-
Constant.PythonPath = path;
168-
}
169-
else
170-
{
171-
Log.Error("PluginsLoader", $"Tried to automatically set from Settings.PythonDirectory " +
172-
$"but can't find python executable in {path}", "PythonPlugins");
173-
}
174-
}
175-
176118
if (string.IsNullOrEmpty(settings.PythonDirectory))
177119
{
178120
if (MessageBox.Show("Flow detected you have installed Python plugins, " +

0 commit comments

Comments
 (0)