Skip to content

Commit b50db58

Browse files
committed
Add assembly name & plugin settings path & plugin cache path in meta data for non-csharp plugins
1 parent d07b304 commit b50db58

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Flow.Launcher.Plugin.SharedCommands;
55
using System;
66
using System.Collections.Generic;
7+
using System.IO;
78
using System.Linq;
89
using System.Windows;
910
using System.Windows.Forms;
@@ -113,7 +114,12 @@ private IEnumerable<PluginPair> SetPathForPluginPairs(string filePath, string la
113114
foreach (var metadata in PluginMetadataList)
114115
{
115116
if (metadata.Language.Equals(languageToSet, StringComparison.OrdinalIgnoreCase))
117+
{
116118
pluginPairs.Add(CreatePluginPair(filePath, metadata));
119+
metadata.AssemblyName = string.Empty;
120+
metadata.PluginSettingsDirectoryPath = Path.Combine(DataLocation.PluginSettingsDirectory, metadata.Name);
121+
metadata.PluginCacheDirectoryPath = Path.Combine(DataLocation.PluginCacheDirectory, metadata.Name);
122+
}
117123
}
118124

119125
return pluginPairs;

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,39 @@ public static IEnumerable<PluginPair> ExecutablePlugins(IEnumerable<PluginMetada
139139
{
140140
return source
141141
.Where(o => o.Language.Equals(AllowedLanguage.Executable, StringComparison.OrdinalIgnoreCase))
142-
.Select(metadata => new PluginPair
142+
.Select(metadata =>
143143
{
144-
Plugin = new ExecutablePlugin(metadata.ExecuteFilePath), Metadata = metadata
144+
var plugin = new PluginPair
145+
{
146+
Plugin = new ExecutablePlugin(metadata.ExecuteFilePath),
147+
Metadata = metadata
148+
};
149+
150+
plugin.Metadata.AssemblyName = string.Empty;
151+
plugin.Metadata.PluginSettingsDirectoryPath = Path.Combine(DataLocation.PluginSettingsDirectory, plugin.Metadata.Name);
152+
plugin.Metadata.PluginCacheDirectoryPath = Path.Combine(DataLocation.PluginCacheDirectory, plugin.Metadata.Name);
153+
154+
return plugin;
145155
});
146156
}
147157

148158
public static IEnumerable<PluginPair> ExecutableV2Plugins(IEnumerable<PluginMetadata> source)
149159
{
150160
return source
151161
.Where(o => o.Language.Equals(AllowedLanguage.ExecutableV2, StringComparison.OrdinalIgnoreCase))
152-
.Select(metadata => new PluginPair
162+
.Select(metadata =>
153163
{
154-
Plugin = new ExecutablePluginV2(metadata.ExecuteFilePath), Metadata = metadata
164+
var plugin = new PluginPair
165+
{
166+
Plugin = new ExecutablePlugin(metadata.ExecuteFilePath),
167+
Metadata = metadata
168+
};
169+
170+
plugin.Metadata.AssemblyName = string.Empty;
171+
plugin.Metadata.PluginSettingsDirectoryPath = Path.Combine(DataLocation.PluginSettingsDirectory, plugin.Metadata.Name);
172+
plugin.Metadata.PluginCacheDirectoryPath = Path.Combine(DataLocation.PluginCacheDirectory, plugin.Metadata.Name);
173+
174+
return plugin;
155175
});
156176
}
157177
}

0 commit comments

Comments
 (0)