mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
set Constant env paths variables when PlugingSettings is set
This commit is contained in:
parent
adf712ddd6
commit
4b0d17c81c
3 changed files with 31 additions and 28 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
using Droplex;
|
using Droplex;
|
||||||
using Flow.Launcher.Core.Plugin;
|
using Flow.Launcher.Core.Plugin;
|
||||||
using Flow.Launcher.Infrastructure;
|
using Flow.Launcher.Infrastructure;
|
||||||
using Flow.Launcher.Infrastructure.Logger;
|
using Flow.Launcher.Infrastructure.Logger;
|
||||||
|
|
@ -89,10 +89,7 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
||||||
selectedFile = GetFileFromDialog(msg, "Python|pythonw.exe");
|
selectedFile = GetFileFromDialog(msg, "Python|pythonw.exe");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(selectedFile))
|
if (!string.IsNullOrEmpty(selectedFile))
|
||||||
{
|
pluginSettings.PythonFilePath = selectedFile;
|
||||||
Constant.PythonPath = selectedFile;
|
|
||||||
pluginSettings.PythonFilePath = Constant.PythonPath;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AllowedLanguage.TypeScript:
|
case AllowedLanguage.TypeScript:
|
||||||
|
|
@ -100,10 +97,7 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
||||||
selectedFile = GetFileFromDialog(msg);
|
selectedFile = GetFileFromDialog(msg);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(selectedFile))
|
if (!string.IsNullOrEmpty(selectedFile))
|
||||||
{
|
pluginSettings.NodeFilePath = selectedFile;
|
||||||
Constant.NodePath = selectedFile;
|
|
||||||
pluginSettings.NodeFilePath = Constant.NodePath;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -121,11 +115,11 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
||||||
|
|
||||||
switch (languageType)
|
switch (languageType)
|
||||||
{
|
{
|
||||||
case AllowedLanguage.Python when FilesFolders.FileExists(pluginSettings.PythonFilePath) && !string.IsNullOrEmpty(Constant.PythonPath):
|
case AllowedLanguage.Python when FilesFolders.FileExists(pluginSettings.PythonFilePath):
|
||||||
return SetPathForPluginPairs(pluginSettings.PythonFilePath, languageType);
|
return SetPathForPluginPairs(pluginSettings.PythonFilePath, languageType);
|
||||||
|
|
||||||
case AllowedLanguage.TypeScript when FilesFolders.FileExists(pluginSettings.NodeFilePath) && !string.IsNullOrEmpty(Constant.NodePath):
|
case AllowedLanguage.TypeScript when FilesFolders.FileExists(pluginSettings.NodeFilePath):
|
||||||
case AllowedLanguage.JavaScript when FilesFolders.FileExists(pluginSettings.NodeFilePath) && !string.IsNullOrEmpty(Constant.NodePath):
|
case AllowedLanguage.JavaScript when FilesFolders.FileExists(pluginSettings.NodeFilePath):
|
||||||
return SetPathForPluginPairs(pluginSettings.NodeFilePath, languageType);
|
return SetPathForPluginPairs(pluginSettings.NodeFilePath, languageType);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -150,8 +144,7 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
||||||
// Python 3.8.9 is used for Windows 7 compatibility
|
// Python 3.8.9 is used for Windows 7 compatibility
|
||||||
DroplexPackage.Drop(App.python_3_8_9_embeddable, pythonDirPath).Wait();
|
DroplexPackage.Drop(App.python_3_8_9_embeddable, pythonDirPath).Wait();
|
||||||
|
|
||||||
Constant.PythonPath = Path.Combine(pythonDirPath, PythonExecutable);
|
pluginSettings.PythonFilePath = Path.Combine(pythonDirPath, PythonExecutable);
|
||||||
pluginSettings.PythonFilePath = Constant.PythonPath;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AllowedLanguage.TypeScript:
|
case AllowedLanguage.TypeScript:
|
||||||
|
|
@ -161,8 +154,7 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
||||||
|
|
||||||
DroplexPackage.Drop(App.nodejs_16_18_0, nodeDirPath).Wait();
|
DroplexPackage.Drop(App.nodejs_16_18_0, nodeDirPath).Wait();
|
||||||
|
|
||||||
Constant.NodePath = Path.Combine(nodeDirPath, $"node-v16.18.0-win-x64\\{NodeExecutable}");
|
pluginSettings.NodeFilePath = Path.Combine(nodeDirPath, $"node-v16.18.0-win-x64\\{NodeExecutable}");
|
||||||
pluginSettings.NodeFilePath = Constant.NodePath;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,26 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
||||||
{
|
{
|
||||||
public class PluginsSettings : BaseModel
|
public class PluginsSettings : BaseModel
|
||||||
{
|
{
|
||||||
public string PythonFilePath { get; set; }
|
private string pythonFilePath;
|
||||||
|
public string PythonFilePath {
|
||||||
|
get { return pythonFilePath; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
pythonFilePath = value;
|
||||||
|
Constant.PythonPath = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string NodeFilePath { get; set; }
|
private string nodeFilePath;
|
||||||
|
public string NodeFilePath
|
||||||
|
{
|
||||||
|
get { return nodeFilePath; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
nodeFilePath = value;
|
||||||
|
Constant.NodePath = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<string, Plugin> Plugins { get; set; } = new Dictionary<string, Plugin>();
|
public Dictionary<string, Plugin> Plugins { get; set; } = new Dictionary<string, Plugin>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Droplex;
|
using Droplex;
|
||||||
using Flow.Launcher.Core.ExternalPlugins;
|
using Flow.Launcher.Core.ExternalPlugins;
|
||||||
using Flow.Launcher.Core.Plugin;
|
using Flow.Launcher.Core.Plugin;
|
||||||
using Flow.Launcher.Core.Resource;
|
using Flow.Launcher.Core.Resource;
|
||||||
|
|
@ -77,10 +77,7 @@ namespace Flow.Launcher
|
||||||
"Python|pythonw.exe");
|
"Python|pythonw.exe");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(selectedFile))
|
if (!string.IsNullOrEmpty(selectedFile))
|
||||||
{
|
settings.PluginSettings.PythonFilePath = selectedFile;
|
||||||
Constant.PythonPath = selectedFile;
|
|
||||||
settings.PluginSettings.PythonFilePath = Constant.PythonPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSelectNodeFilePathClick(object sender, RoutedEventArgs e)
|
private void OnSelectNodeFilePathClick(object sender, RoutedEventArgs e)
|
||||||
|
|
@ -89,10 +86,7 @@ namespace Flow.Launcher
|
||||||
InternationalizationManager.Instance.GetTranslation("selectNodeExecutable"));
|
InternationalizationManager.Instance.GetTranslation("selectNodeExecutable"));
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(selectedFile))
|
if (!string.IsNullOrEmpty(selectedFile))
|
||||||
{
|
settings.PluginSettings.NodeFilePath = selectedFile;
|
||||||
Constant.NodePath = selectedFile;
|
|
||||||
settings.PluginSettings.NodeFilePath = Constant.NodePath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSelectFileManagerClick(object sender, RoutedEventArgs e)
|
private void OnSelectFileManagerClick(object sender, RoutedEventArgs e)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue