define plugin metadata file name as constant

This commit is contained in:
Ioannis G 2020-06-10 01:59:25 +03:00
parent 4abc9d8551
commit 0ddd7f24f4
No known key found for this signature in database
GPG key ID: EAC0E4E5E36AC49E
4 changed files with 8 additions and 8 deletions

View file

@ -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";
/// <summary>
/// Parse plugin metadata in the given directories
/// </summary>
@ -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}>");

View file

@ -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))

View file

@ -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";

View file

@ -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";