Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
4ea1ee0
add Node.js environment setup
jjw24 Oct 23, 2022
eb203c2
executable plugin language check ignore case
jjw24 Oct 23, 2022
7441e90
python language check ignore case
jjw24 Oct 23, 2022
9e55fc5
add node plugin execution
jjw24 Oct 23, 2022
9b4a592
add Node.js file path browser to Settings window
jjw24 Oct 24, 2022
e29e2bd
change language key selectPythonDirectory to select
jjw24 Oct 24, 2022
acb6306
in Settings Window separate language from plugin env section
jjw24 Oct 24, 2022
65db4e4
add translation for file browser window title
jjw24 Oct 24, 2022
5263bf5
add filter to file dialog for selecting Python exe
jjw24 Oct 25, 2022
76c0f03
update python directory to python file directory
jjw24 Oct 25, 2022
56e6d6e
remove pythonDirectory language key
jjw24 Oct 25, 2022
1bb2de3
change wording 'No Setting' to 'None' when no path
jjw24 Oct 25, 2022
adf712d
add Node.js path to error reporting
jjw24 Oct 25, 2022
4b0d17c
set Constant env paths variables when PlugingSettings is set
jjw24 Oct 25, 2022
f76e296
update set plugin path for python
jjw24 Oct 28, 2022
2dcd4d7
centralise all plugin env folders in Environments directory
jjw24 Oct 28, 2022
c013713
Merge remote-tracking branch 'origin/dev' into add_nodejs_env
jjw24 Nov 19, 2022
c7cee4a
add ensure latest installation
jjw24 Nov 20, 2022
4e48c3e
refactor
jjw24 Nov 21, 2022
6561253
ensure latest only when using Flow's env setup
jjw24 Nov 21, 2022
2dba518
Merge remote-tracking branch 'origin/dev' into add_nodejs_env
jjw24 Nov 27, 2022
9eb5489
update setting's environment file paths after app update
jjw24 Nov 27, 2022
07bc2a7
remove PythonEmbeddable location
jjw24 Nov 28, 2022
680ed77
add abstract create plugin pair method to handle each plugin type
jjw24 Nov 30, 2022
d297779
remove unused SupportedLanguage property
jjw24 Nov 30, 2022
5975b6e
plugin env paths correction after update or mode change
jjw24 Dec 1, 2022
87e49cd
formatting
jjw24 Dec 1, 2022
e1e8951
remove duplicated updater pre-startup methods
jjw24 Dec 1, 2022
e28906d
rename method
jjw24 Dec 1, 2022
cef53bc
add empty string defaults to plugin executable paths
jjw24 Dec 2, 2022
0daf52f
remove PythonEmbeddable folder regardless if it's being used or not
jjw24 Dec 6, 2022
d2658c7
add null check
jjw24 Dec 6, 2022
5373cd3
Disable PATH programs by default
VictoriousRaptor Dec 17, 2022
1d77d45
Add an option to enable/dsiable UWP indexing
VictoriousRaptor Dec 17, 2022
bf91bd2
Fix double click on header
VictoriousRaptor Dec 17, 2022
68bc6fb
Merge branch 'dev' into DisablePATHByDefault
taooceros Dec 18, 2022
13eba18
Disable PATH programs by default
VictoriousRaptor Dec 17, 2022
d3bae93
Revert "Disable PATH by default"
VictoriousRaptor Dec 18, 2022
7d16451
#1678 Add "hh:mm:ss tt" to clock formats.
z1nc0r3 Dec 18, 2022
4fd5039
Fix item can't be unselected after editing shortcut
VictoriousRaptor Dec 18, 2022
8fbf7a8
Add Time sec format
onesounds Dec 19, 2022
56d6433
Improve folder editor experience
fihorvat Dec 19, 2022
9564092
Bump nunit from 3.13.2 to 3.13.3
dependabot[bot] Dec 19, 2022
5cc4a36
Add StartEn Setting
onesounds Dec 20, 2022
2e1b402
Merge pull request #1692 from Flow-Launcher/dependabot/nuget/nunit-3.…
jjw24 Dec 20, 2022
5af272a
Merge branch 'dev' into add_nodejs_env
jjw24 Dec 20, 2022
d0b5a5a
version bump Program plugin
jjw24 Dec 20, 2022
ac1658f
add comment
jjw24 Dec 20, 2022
35fb999
Merge pull request #1676 from VictoriousRaptor/DisablePATHSource
jjw24 Dec 20, 2022
f20026a
Merge branch 'dev' into Fix1682
VictoriousRaptor Dec 20, 2022
c428df0
Merge pull request #1684 from VictoriousRaptor/Fix1682
jjw24 Dec 20, 2022
a77eb38
Merge branch 'dev' into LanguageStart
VictoriousRaptor Dec 20, 2022
0d00734
Update wording
VictoriousRaptor Dec 20, 2022
075ce37
Merge branch 'LanguageStart' of https://github.com/onesounds/Flow.Lau…
VictoriousRaptor Dec 20, 2022
179f287
Adjust Pinyin Item Position in General Tab
onesounds Dec 20, 2022
2e0c2b3
Merge branch 'LanguageStart' of https://github.com/onesounds/Flow.Lau…
onesounds Dec 20, 2022
b92181f
Remove logic that modifies settings
VictoriousRaptor Dec 20, 2022
3dac240
Add open with shell context menu for non-Windows indexed folders
VictoriousRaptor Dec 20, 2022
8625fb9
Use case-insensitive path comparison
VictoriousRaptor Dec 20, 2022
c6e82cc
Update wording
VictoriousRaptor Dec 20, 2022
a93bafe
Merge branch 'LanguageStart' of https://github.com/onesounds/Flow.Lau…
VictoriousRaptor Dec 20, 2022
ce30315
Use binding for ime conversion mode
VictoriousRaptor Dec 20, 2022
9d59933
Add IME state
VictoriousRaptor Dec 20, 2022
3ae2ede
Merge pull request #1693 from onesounds/LanguageStart
VictoriousRaptor Dec 20, 2022
2d32b33
Merge branch 'dev' into DisablePATHByDefault
VictoriousRaptor Dec 21, 2022
3b6c8b8
Add translatble text
VictoriousRaptor Dec 21, 2022
8fbf3a3
make file/folder translatble
VictoriousRaptor Dec 21, 2022
7c5c1e8
remove redundant texts
VictoriousRaptor Dec 21, 2022
3160379
Merge branch 'dev' into FixText
VictoriousRaptor Dec 21, 2022
5696caf
update wording
VictoriousRaptor Dec 21, 2022
0a3c59a
Merge branch 'FixText' of https://github.com/VictoriousRaptor/Flow.La…
VictoriousRaptor Dec 21, 2022
812a920
Adjust Little String / Add Korean Translations
onesounds Dec 21, 2022
ae1ea59
Merge branch 'FixText' of https://github.com/VictoriousRaptor/Flow.La…
onesounds Dec 21, 2022
43e3b1f
Adjust Korean Texts
onesounds Dec 21, 2022
3b95b90
Move TranslationConverter to Core
VictoriousRaptor Dec 21, 2022
b30ace9
Fix namespace of LocalizationConverter
VictoriousRaptor Dec 21, 2022
230e4fb
Fix translation of action keywords
VictoriousRaptor Dec 21, 2022
137cda4
Merge branch 'FixText' of https://github.com/VictoriousRaptor/Flow.La…
VictoriousRaptor Dec 21, 2022
2dabc38
- Change Default Context menu header to translatable
onesounds Dec 21, 2022
b74a8d0
Adjust Korean
onesounds Dec 21, 2022
cc0c198
Merge pull request #1695 from VictoriousRaptor/FixText
onesounds Dec 21, 2022
5ad0e79
- Change Status Label to Enabled
onesounds Dec 21, 2022
af0050e
Remove Hiding the Disabled menu Item
onesounds Dec 21, 2022
d2970a1
Merge branch 'dev' into folder-editor
fihorvat Dec 21, 2022
277b8e9
Adds option to display open with code for Volume results
fihorvat Dec 21, 2022
2d00e98
Merge pull request #1691 from fihorvat/folder-editor
taooceros Dec 21, 2022
e4c9e1c
fix a typo
taooceros Dec 21, 2022
d84f237
Merge pull request #1701 from Flow-Launcher/taooceros-patch-1
jjw24 Dec 22, 2022
9ae5d9b
Fix search source typo
jjw24 Dec 22, 2022
b3f5dc0
Merge pull request #1698 from onesounds/StringEnabled2
jjw24 Dec 22, 2022
bade0fc
Merge pull request #1669 from VictoriousRaptor/DisablePATHByDefault
VictoriousRaptor Dec 22, 2022
f0b7898
fix quick access path search and autocomplete text
jjw24 Dec 22, 2022
5c1cc79
update GetPathWithActionKeyword
jjw24 Dec 22, 2022
fc9805f
add GetAutoCompleteText method
jjw24 Dec 22, 2022
2174fc2
update directory navigation with same action keyword
jjw24 Dec 22, 2022
cb44966
Catch exceptions during shortcut expansion
VictoriousRaptor Dec 22, 2022
14216a4
Remove redundant default value
VictoriousRaptor Dec 22, 2022
5de74c4
Fix changing OpenResultModifiers in settings won't reflect to main wi…
VictoriousRaptor Dec 22, 2022
e11c7a7
Remove Duplicated Key
onesounds Dec 23, 2022
4f8f4d4
Merge pull request #1710 from onesounds/HotfixKoreanDulicatedKey
VictoriousRaptor Dec 23, 2022
f97c9fe
Update wording for consistency
VictoriousRaptor Dec 23, 2022
599bdc4
Remove quotation marks
VictoriousRaptor Dec 23, 2022
cc45dee
Add preview hotky in settings
VictoriousRaptor Dec 22, 2022
7f0e735
Use data binding
VictoriousRaptor Dec 22, 2022
2476e2d
Only load preview when preview panel is open
VictoriousRaptor Dec 22, 2022
33c0af1
Use ShowIcon to determine when to load
VictoriousRaptor Dec 22, 2022
f210102
Use KeyBinding in xaml
VictoriousRaptor Dec 22, 2022
4c2760e
Comment F1 keybinding
VictoriousRaptor Dec 23, 2022
23de7cf
Delete unused function
VictoriousRaptor Dec 23, 2022
e94929a
Merge pull request #1711 from VictoriousRaptor/UpdateWording
VictoriousRaptor Dec 23, 2022
b1eb191
Formatting
VictoriousRaptor Dec 23, 2022
b18f5f4
remove unused using
VictoriousRaptor Dec 23, 2022
33615d1
Neutralize warning
VictoriousRaptor Dec 23, 2022
47d109c
Refactor toggle game mode logic
VictoriousRaptor Dec 23, 2022
ca60524
Merge branch 'dev' into RefactorMainWindow
VictoriousRaptor Dec 23, 2022
8759762
Remove Segoe UI to fix Chinese font
VictoriousRaptor Dec 23, 2022
ccac84c
Fix hardcoded strings
VictoriousRaptor Dec 23, 2022
552786b
Merge branch 'dev' into Fix1705
VictoriousRaptor Dec 23, 2022
5a5d407
Merge pull request #1713 from VictoriousRaptor/Fix1705
VictoriousRaptor Dec 23, 2022
e625bf1
Remove comment
VictoriousRaptor Dec 24, 2022
fac2428
add folder and file get path unit tests
jjw24 Dec 24, 2022
f64ebdc
simplify get path method
jjw24 Dec 24, 2022
3f2b741
add unit tests for get autocomplete result
jjw24 Dec 24, 2022
9f8b205
Merge remote-tracking branch 'origin/dev' into fix_quickaccess_autoco…
jjw24 Dec 24, 2022
d386735
Merge remote-tracking branch 'origin/dev' into add_nodejs_env
jjw24 Dec 24, 2022
ae8f2d2
fix wrong Everything service warning displayed when not available
jjw24 Dec 24, 2022
9027a20
Merge pull request #1712 from VictoriousRaptor/RefactorMainWindow
VictoriousRaptor Dec 24, 2022
990ae3b
Merge pull request #1715 from Flow-Launcher/fix_everything_warning
jjw24 Dec 25, 2022
24349d5
Merge remote-tracking branch 'upstream/dev' into LazyLoadPreview
VictoriousRaptor Dec 25, 2022
8566279
Merge branch 'dev' into LazyLoadPreview
VictoriousRaptor Dec 25, 2022
ae66a2c
Merge branch 'dev' into add_nodejs_env
VictoriousRaptor Dec 25, 2022
6607acb
Merge pull request #1706 from Flow-Launcher/fix_quickaccess_autocomplete
jjw24 Dec 25, 2022
6c53b7e
Merge branch 'dev' into dev
VictoriousRaptor Dec 25, 2022
b65a32a
Remove redundant tt
VictoriousRaptor Dec 25, 2022
7562444
Merge pull request #1708 from VictoriousRaptor/FixShortcutException
VictoriousRaptor Dec 25, 2022
151c17a
Merge pull request #1680 from z1nc0r3/dev
VictoriousRaptor Dec 26, 2022
8a60fb1
WindowsSettings plugin - command updated for diskmgmt
z1nc0r3 Dec 26, 2022
fa21230
Remove todo
VictoriousRaptor Dec 26, 2022
5bab210
Merge pull request #1719 from z1nc0r3/dev
jjw24 Dec 26, 2022
596c82a
Bump Microsoft.VisualStudio.Threading from 17.3.44 to 17.4.27
dependabot[bot] Dec 26, 2022
4040081
Merge pull request #1721 from Flow-Launcher/dependabot/nuget/Microsof…
jjw24 Dec 27, 2022
efbc588
Merge pull request #1699 from onesounds/RemoveDisabledMenuItem
jjw24 Dec 27, 2022
b3702be
version bump plugins
jjw24 Dec 27, 2022
f980cda
version bump
jjw24 Dec 27, 2022
68ae8a1
Only call LoadPreviewImage when using default preview
VictoriousRaptor Dec 27, 2022
7da7e60
Merge branch 'dev' into add_nodejs_env
jjw24 Dec 27, 2022
78b8e5b
update Explorer plugin description
jjw24 Dec 27, 2022
831d39e
Merge pull request #1724 from Flow-Launcher/explorer_description_update
jjw24 Dec 27, 2022
9aab01d
Fix typo
VictoriousRaptor Dec 27, 2022
786e3a0
Merge pull request #1725 from Flow-Launcher/VictoriousRaptor-patch-1
VictoriousRaptor Dec 27, 2022
979aa3d
Support hotkey modifiers
VictoriousRaptor Dec 27, 2022
3ff7566
Use databinding for preview hotkey
VictoriousRaptor Dec 27, 2022
b243683
Add option to modify preview hotkey
VictoriousRaptor Dec 27, 2022
bdbef54
Move to proper location
VictoriousRaptor Dec 27, 2022
8f3ca61
Show Preview Hotkey in tooltip
VictoriousRaptor Dec 27, 2022
9154da2
Update tooltip to avoid untranslated fixed "F1"
VictoriousRaptor Dec 27, 2022
0140e34
Update readme
VictoriousRaptor Dec 28, 2022
76357fb
Update tooltip when hotkey changes
VictoriousRaptor Dec 28, 2022
75a23d1
Fix option order in setting window
VictoriousRaptor Dec 28, 2022
50cd17e
Merge branch 'dev' into add_nodejs_env
VictoriousRaptor Dec 28, 2022
944e0f1
Merge pull request #1498 from Flow-Launcher/add_nodejs_env
jjw24 Dec 28, 2022
b5c4805
Fix ImageCache when loading full image
VictoriousRaptor Dec 28, 2022
5970b1c
Change glyph for preview hotkey
VictoriousRaptor Dec 28, 2022
95aaa9f
Add preview delegate
VictoriousRaptor Dec 23, 2022
617d2f5
Use separate variable for preview image
VictoriousRaptor Dec 28, 2022
35d96bd
Fix logic for imagepath and delegate
VictoriousRaptor Dec 28, 2022
a40e15f
Remove duplicate null check
VictoriousRaptor Dec 29, 2022
e83e21d
Add TryGetValue for ImageLoader
VictoriousRaptor Dec 29, 2022
62821d3
Use Visibility for consistency
VictoriousRaptor Dec 29, 2022
f67b66e
update readme for toggle preview hotkey
jjw24 Dec 29, 2022
4513f24
Update README.md
jjw24 Dec 29, 2022
f42f87c
Merge pull request #1709 from VictoriousRaptor/LazyLoadPreview
VictoriousRaptor Dec 29, 2022
25ec843
Merge branch 'dev' into FixImageCache
Garulf Dec 29, 2022
5c5dbf2
Merge pull request #1727 from VictoriousRaptor/FixImageCache
VictoriousRaptor Dec 29, 2022
779a7e5
version bump plugin project
jjw24 Dec 30, 2022
e23ec17
Merge pull request #1723 from Flow-Launcher/version_bumps
jjw24 Dec 30, 2022
4849e26
New Crowdin updates (#1733)
jjw24 Dec 30, 2022
95d1858
Add Winget Releaser workflow
sitiom Nov 19, 2022
0b35f31
update winget action schedule interval to daily
jjw24 Dec 30, 2022
bb41da6
New Crowdin updates (#1734)
jjw24 Dec 30, 2022
e0cd63a
Merge pull request #1559 from sitiom/winget-releaser
jjw24 Dec 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ updates:
- "jjw24"
- "taooceros"
- "JohnTheGr8"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
15 changes: 15 additions & 0 deletions .github/workflows/winget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish to Winget

on:
release:
types: [released]

jobs:
publish:
# Action can only be run on windows
runs-on: windows-latest
steps:
- uses: vedantmgoyal2009/winget-releaser@v1
with:
identifier: Flow-Launcher.Flow-Launcher
token: ${{ secrets.WINGET_TOKEN }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace Flow.Launcher.Core.ExternalPlugins.Environments
{
public abstract class AbstractPluginEnvironment
{
internal abstract string Language { get; }

internal abstract string EnvName { get; }

internal abstract string EnvPath { get; }

internal abstract string InstallPath { get; }

internal abstract string ExecutablePath { get; }

internal virtual string FileDialogFilter => string.Empty;

internal abstract string PluginsSettingsFilePath { get; set; }

internal List<PluginMetadata> PluginMetadataList;

internal PluginsSettings PluginSettings;

internal AbstractPluginEnvironment(List<PluginMetadata> pluginMetadataList, PluginsSettings pluginSettings)
{
PluginMetadataList = pluginMetadataList;
PluginSettings = pluginSettings;
}

internal IEnumerable<PluginPair> Setup()
{
if (!PluginMetadataList.Any(o => o.Language.Equals(Language, StringComparison.OrdinalIgnoreCase)))
return new List<PluginPair>();

// TODO: Remove. This is backwards compatibility for 1.10.0 release- changed PythonEmbeded to Environments/Python
if (Language.Equals(AllowedLanguage.Python, StringComparison.OrdinalIgnoreCase))
{
FilesFolders.RemoveFolderIfExists(Path.Combine(DataLocation.DataDirectory(), "PythonEmbeddable"));

if (!string.IsNullOrEmpty(PluginSettings.PythonDirectory) && PluginSettings.PythonDirectory.StartsWith(Path.Combine(DataLocation.DataDirectory(), "PythonEmbeddable")))
{
InstallEnvironment();
PluginSettings.PythonDirectory = string.Empty;
}
}

if (!string.IsNullOrEmpty(PluginsSettingsFilePath) && FilesFolders.FileExists(PluginsSettingsFilePath))
{
// Ensure latest only if user is using Flow's environment setup.
if (PluginsSettingsFilePath.StartsWith(EnvPath, StringComparison.OrdinalIgnoreCase))
EnsureLatestInstalled(ExecutablePath, PluginsSettingsFilePath, EnvPath);

return SetPathForPluginPairs(PluginsSettingsFilePath, Language);
}

if (MessageBox.Show($"Flow detected you have installed {Language} plugins, which " +
$"will require {EnvName} to run. Would you like to download {EnvName}? " +
Environment.NewLine + Environment.NewLine +
"Click no if it's already installed, " +
$"and you will be prompted to select the folder that contains the {EnvName} executable",
string.Empty, MessageBoxButtons.YesNo) == DialogResult.No)
{
var msg = $"Please select the {EnvName} executable";
var selectedFile = string.Empty;

selectedFile = GetFileFromDialog(msg, FileDialogFilter);

if (!string.IsNullOrEmpty(selectedFile))
PluginsSettingsFilePath = selectedFile;

// Nothing selected because user pressed cancel from the file dialog window
if (string.IsNullOrEmpty(selectedFile))
InstallEnvironment();
}
else
{
InstallEnvironment();
}

if (FilesFolders.FileExists(PluginsSettingsFilePath))
{
return SetPathForPluginPairs(PluginsSettingsFilePath, Language);
}
else
{
MessageBox.Show(
$"Unable to set {Language} executable path, please try from Flow's settings (scroll down to the bottom).");
Log.Error("PluginsLoader",
$"Not able to successfully set {EnvName} path, setting's plugin executable path variable is still an empty string.",
$"{Language}Environment");

return new List<PluginPair>();
}
}

internal abstract void InstallEnvironment();

private void EnsureLatestInstalled(string expectedPath, string currentPath, string installedDirPath)
{
if (expectedPath == currentPath)
return;

FilesFolders.RemoveFolderIfExists(installedDirPath);

InstallEnvironment();

}

internal abstract PluginPair CreatePluginPair(string filePath, PluginMetadata metadata);

private IEnumerable<PluginPair> SetPathForPluginPairs(string filePath, string languageToSet)
{
var pluginPairs = new List<PluginPair>();

foreach (var metadata in PluginMetadataList)
{
if (metadata.Language.Equals(languageToSet, StringComparison.OrdinalIgnoreCase))
pluginPairs.Add(CreatePluginPair(filePath, metadata));
}

return pluginPairs;
}

private string GetFileFromDialog(string title, string filter = "")
{
var dlg = new OpenFileDialog
{
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
Multiselect = false,
CheckFileExists = true,
CheckPathExists = true,
Title = title,
Filter = filter
};

var result = dlg.ShowDialog();
if (result == DialogResult.OK)
{
return dlg.FileName;
}
else
{
return string.Empty;
}
}

/// <summary>
/// After app updated while in portable mode or switched between portable/roaming mode,
/// need to update each plugin's executable path so user will not be prompted again to reinstall the environments.
/// </summary>
/// <param name="settings"></param>
public static void PreStartPluginExecutablePathUpdate(Settings settings)
{
if (DataLocation.PortableDataLocationInUse())
{
// When user is using portable but has moved flow to a different location
if (IsUsingPortablePath(settings.PluginSettings.PythonExecutablePath, DataLocation.PythonEnvironmentName)
&& !settings.PluginSettings.PythonExecutablePath.StartsWith(DataLocation.PortableDataPath))
{
settings.PluginSettings.PythonExecutablePath
= GetUpdatedEnvironmentPath(settings.PluginSettings.PythonExecutablePath);
}

if (IsUsingPortablePath(settings.PluginSettings.NodeExecutablePath, DataLocation.NodeEnvironmentName)
&& !settings.PluginSettings.NodeExecutablePath.StartsWith(DataLocation.PortableDataPath))
{
settings.PluginSettings.NodeExecutablePath
= GetUpdatedEnvironmentPath(settings.PluginSettings.NodeExecutablePath);
}

// When user has switched from roaming to portable
if (IsUsingRoamingPath(settings.PluginSettings.PythonExecutablePath))
{
settings.PluginSettings.PythonExecutablePath
= settings.PluginSettings.PythonExecutablePath.Replace(DataLocation.RoamingDataPath, DataLocation.PortableDataPath);
}

if (IsUsingRoamingPath(settings.PluginSettings.NodeExecutablePath))
{
settings.PluginSettings.NodeExecutablePath
= settings.PluginSettings.NodeExecutablePath.Replace(DataLocation.RoamingDataPath, DataLocation.PortableDataPath);
}
}
else
{
if (IsUsingPortablePath(settings.PluginSettings.PythonExecutablePath, DataLocation.PythonEnvironmentName))
settings.PluginSettings.PythonExecutablePath
= GetUpdatedEnvironmentPath(settings.PluginSettings.PythonExecutablePath);

if (IsUsingPortablePath(settings.PluginSettings.NodeExecutablePath, DataLocation.NodeEnvironmentName))
settings.PluginSettings.NodeExecutablePath
= GetUpdatedEnvironmentPath(settings.PluginSettings.NodeExecutablePath);
}
}

private static bool IsUsingPortablePath(string filePath, string pluginEnvironmentName)
{
if (string.IsNullOrEmpty(filePath))
return false;

// DataLocation.PortableDataPath returns the current portable path, this determines if an out
// of date path is also a portable path.
var portableAppEnvLocation = $"UserData\\{DataLocation.PluginEnvironments}\\{pluginEnvironmentName}";

return filePath.Contains(portableAppEnvLocation);
}

private static bool IsUsingRoamingPath(string filePath)
{
if (string.IsNullOrEmpty(filePath))
return false;

return filePath.StartsWith(DataLocation.RoamingDataPath);
}

private static string GetUpdatedEnvironmentPath(string filePath)
{
var index = filePath.IndexOf(DataLocation.PluginEnvironments);

// get the substring after "Environments" because we can not determine it dynamically
var ExecutablePathSubstring = filePath.Substring(index + DataLocation.PluginEnvironments.Count());
return $"{DataLocation.PluginEnvironmentsPath}{ExecutablePathSubstring}";
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.Generic;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;

namespace Flow.Launcher.Core.ExternalPlugins.Environments
{

internal class JavaScriptEnvironment : TypeScriptEnvironment
{
internal override string Language => AllowedLanguage.JavaScript;

internal JavaScriptEnvironment(List<PluginMetadata> pluginMetadataList, PluginsSettings pluginSettings) : base(pluginMetadataList, pluginSettings) { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Droplex;
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using System.Collections.Generic;
using System.IO;

namespace Flow.Launcher.Core.ExternalPlugins.Environments
{
internal class PythonEnvironment : AbstractPluginEnvironment
{
internal override string Language => AllowedLanguage.Python;

internal override string EnvName => DataLocation.PythonEnvironmentName;

internal override string EnvPath => Path.Combine(DataLocation.PluginEnvironmentsPath, EnvName);

internal override string InstallPath => Path.Combine(EnvPath, "PythonEmbeddable-v3.8.9");

internal override string ExecutablePath => Path.Combine(InstallPath, "pythonw.exe");

internal override string FileDialogFilter => "Python|pythonw.exe";

internal override string PluginsSettingsFilePath { get => PluginSettings.PythonExecutablePath; set => PluginSettings.PythonExecutablePath = value; }

internal PythonEnvironment(List<PluginMetadata> pluginMetadataList, PluginsSettings pluginSettings) : base(pluginMetadataList, pluginSettings) { }

internal override void InstallEnvironment()
{
FilesFolders.RemoveFolderIfExists(InstallPath);

// Python 3.8.9 is used for Windows 7 compatibility
DroplexPackage.Drop(App.python_3_8_9_embeddable, InstallPath).Wait();

PluginsSettingsFilePath = ExecutablePath;
}

internal override PluginPair CreatePluginPair(string filePath, PluginMetadata metadata)
{
return new PluginPair
{
Plugin = new PythonPlugin(filePath),
Metadata = metadata
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System.Collections.Generic;
using Droplex;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Plugin;
using System.IO;
using Flow.Launcher.Core.Plugin;

namespace Flow.Launcher.Core.ExternalPlugins.Environments
{
internal class TypeScriptEnvironment : AbstractPluginEnvironment
{
internal override string Language => AllowedLanguage.TypeScript;

internal override string EnvName => DataLocation.NodeEnvironmentName;

internal override string EnvPath => Path.Combine(DataLocation.PluginEnvironmentsPath, EnvName);

internal override string InstallPath => Path.Combine(EnvPath, "Node-v16.18.0");
internal override string ExecutablePath => Path.Combine(InstallPath, "node-v16.18.0-win-x64\\node.exe");

internal override string PluginsSettingsFilePath { get => PluginSettings.NodeExecutablePath; set => PluginSettings.NodeExecutablePath = value; }

internal TypeScriptEnvironment(List<PluginMetadata> pluginMetadataList, PluginsSettings pluginSettings) : base(pluginMetadataList, pluginSettings) { }

internal override void InstallEnvironment()
{
FilesFolders.RemoveFolderIfExists(InstallPath);

DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath).Wait();

PluginsSettingsFilePath = ExecutablePath;
}

internal override PluginPair CreatePluginPair(string filePath, PluginMetadata metadata)
{
return new PluginPair
{
Plugin = new NodePlugin(filePath),
Metadata = metadata
};
}
}
}
2 changes: 1 addition & 1 deletion Flow.Launcher.Core/Flow.Launcher.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Droplex" Version="1.4.1" />
<PackageReference Include="Droplex" Version="1.6.0" />
<PackageReference Include="FSharp.Core" Version="6.0.6" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.1" />
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
Expand Down
1 change: 0 additions & 1 deletion Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Flow.Launcher.Core.Plugin
internal class ExecutablePlugin : JsonRPCPlugin
{
private readonly ProcessStartInfo _startInfo;
public override string SupportedLanguage { get; set; } = AllowedLanguage.Executable;

public ExecutablePlugin(string filename)
{
Expand Down
5 changes: 1 addition & 4 deletions Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ internal abstract class JsonRPCPlugin : IAsyncPlugin, IContextMenu, ISettingProv
{
protected PluginInitContext context;
public const string JsonRPC = "JsonRPC";
/// <summary>
/// The language this JsonRPCPlugin support
/// </summary>
public abstract string SupportedLanguage { get; set; }

protected abstract Task<Stream> RequestAsync(JsonRPCRequestModel rpcRequest, CancellationToken token = default);
protected abstract string Request(JsonRPCRequestModel rpcRequest, CancellationToken token = default);

Expand Down
Loading