diff --git a/Flow.Launcher.Core/Plugin/PluginConfig.cs b/Flow.Launcher.Core/Plugin/PluginConfig.cs index c36534537..b946fa44d 100644 --- a/Flow.Launcher.Core/Plugin/PluginConfig.cs +++ b/Flow.Launcher.Core/Plugin/PluginConfig.cs @@ -1,8 +1,9 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.IO; using Newtonsoft.Json; +using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Plugin; @@ -11,8 +12,6 @@ namespace Flow.Launcher.Core.Plugin internal abstract class PluginConfig { - private const string PluginConfigName = "plugin.json"; - /// /// Parse plugin metadata in the given directories /// @@ -52,7 +51,7 @@ namespace Flow.Launcher.Core.Plugin private static PluginMetadata GetPluginMetadata(string pluginDirectory) { - string configPath = Path.Combine(pluginDirectory, PluginConfigName); + string configPath = Path.Combine(pluginDirectory, Constant.PluginMetadataFileName); if (!File.Exists(configPath)) { Log.Error($"|PluginConfig.GetPluginMetadata|Didn't find config file <{configPath}>"); diff --git a/Flow.Launcher.Core/Plugin/PluginInstaller.cs b/Flow.Launcher.Core/Plugin/PluginInstaller.cs index efb239d7e..b284b957f 100644 --- a/Flow.Launcher.Core/Plugin/PluginInstaller.cs +++ b/Flow.Launcher.Core/Plugin/PluginInstaller.cs @@ -4,6 +4,7 @@ using System.Windows; using ICSharpCode.SharpZipLib.Zip; using Newtonsoft.Json; using Flow.Launcher.Plugin; +using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; namespace Flow.Launcher.Core.Plugin @@ -21,7 +22,7 @@ namespace Flow.Launcher.Core.Plugin } UnZip(path, tempFoler, true); - string iniPath = Path.Combine(tempFoler, "plugin.json"); + string iniPath = Path.Combine(tempFoler, Constant.PluginMetadataFileName); if (!File.Exists(iniPath)) { MessageBox.Show("Install failed: plugin config is missing"); @@ -95,7 +96,7 @@ namespace Flow.Launcher.Core.Plugin private static PluginMetadata GetMetadataFromJson(string pluginDirectory) { - string configPath = Path.Combine(pluginDirectory, "plugin.json"); + string configPath = Path.Combine(pluginDirectory, Constant.PluginMetadataFileName); PluginMetadata metadata; if (!File.Exists(configPath)) diff --git a/Flow.Launcher.Infrastructure/Constant.cs b/Flow.Launcher.Infrastructure/Constant.cs index 0936ce8c4..a96d0e5b3 100644 --- a/Flow.Launcher.Infrastructure/Constant.cs +++ b/Flow.Launcher.Infrastructure/Constant.cs @@ -8,6 +8,7 @@ namespace Flow.Launcher.Infrastructure { public const string FlowLauncher = "Flow.Launcher"; public const string Plugins = "Plugins"; + public const string PluginMetadataFileName = "plugin.json"; public const string ApplicationFileName = FlowLauncher + ".exe"; diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs index 586513acd..e1b631517 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -17,7 +17,6 @@ namespace Flow.Launcher.Plugin.PluginManagement public class Main : IPlugin, IPluginI18n { private static string APIBASE = "http://api.wox.one"; - private static string PluginConfigName = "plugin.json"; private static string pluginSearchUrl = APIBASE + "/plugin/search/"; private const string ListCommand = "list"; private const string InstallCommand = "install";