Skip to content

Commit 0a7ed3b

Browse files
committed
Add AbstractPluginEnvironment.API back
1 parent 0e366a6 commit 0a7ed3b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public abstract class AbstractPluginEnvironment
1414
{
1515
private static readonly string ClassName = nameof(AbstractPluginEnvironment);
1616

17+
protected readonly IPublicAPI API = PublicApi.Instance;
18+
1719
internal abstract string Language { get; }
1820

1921
internal abstract string EnvName { get; }
@@ -56,7 +58,7 @@ internal IEnumerable<PluginPair> Setup()
5658
}
5759

5860
var noRuntimeMessage = Localize.runtimePluginInstalledChooseRuntimePrompt(Language, EnvName, Environment.NewLine);
59-
if (PublicApi.Instance.ShowMsgBox(noRuntimeMessage, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
61+
if (API.ShowMsgBox(noRuntimeMessage, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
6062
{
6163
var msg = Localize.runtimePluginChooseRuntimeExecutable(EnvName);
6264

@@ -74,7 +76,7 @@ internal IEnumerable<PluginPair> Setup()
7476
// Let users select valid path or choose to download
7577
while (string.IsNullOrEmpty(selectedFile))
7678
{
77-
if (PublicApi.Instance.ShowMsgBox(forceDownloadMessage, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
79+
if (API.ShowMsgBox(forceDownloadMessage, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
7880
{
7981
// Continue select file
8082
selectedFile = GetFileFromDialog(msg, FileDialogFilter);
@@ -107,8 +109,8 @@ internal IEnumerable<PluginPair> Setup()
107109
}
108110
else
109111
{
110-
PublicApi.Instance.ShowMsgBox(Localize.runtimePluginUnableToSetExecutablePath(Language));
111-
PublicApi.Instance.LogError(ClassName,
112+
API.ShowMsgBox(Localize.runtimePluginUnableToSetExecutablePath(Language));
113+
API.LogError(ClassName,
112114
$"Not able to successfully set {EnvName} path, setting's plugin executable path variable is still an empty string.",
113115
$"{Language}Environment");
114116

@@ -122,7 +124,7 @@ private void EnsureLatestInstalled(string expectedPath, string currentPath, stri
122124
{
123125
if (expectedPath == currentPath) return;
124126

125-
FilesFolders.RemoveFolderIfExists(installedDirPath, (s) => PublicApi.Instance.ShowMsgBox(s));
127+
FilesFolders.RemoveFolderIfExists(installedDirPath, (s) => API.ShowMsgBox(s));
126128

127129
InstallEnvironment();
128130
}
@@ -235,7 +237,7 @@ private static bool IsUsingRoamingPath(string filePath)
235237
private static string GetUpdatedEnvironmentPath(string filePath)
236238
{
237239
var index = filePath.IndexOf(DataLocation.PluginEnvironments);
238-
240+
239241
// get the substring after "Environments" because we can not determine it dynamically
240242
var executablePathSubstring = filePath[(index + DataLocation.PluginEnvironments.Length)..];
241243
return $"{DataLocation.PluginEnvironmentsPath}{executablePathSubstring}";

0 commit comments

Comments
 (0)