Skip to content

Commit 0ddd7f2

Browse files
committed
define plugin metadata file name as constant
1 parent 4abc9d8 commit 0ddd7f2

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Flow.Launcher.Core/Plugin/PluginConfig.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.IO;
55
using Newtonsoft.Json;
6+
using Flow.Launcher.Infrastructure;
67
using Flow.Launcher.Infrastructure.Logger;
78
using Flow.Launcher.Plugin;
89

@@ -11,8 +12,6 @@ namespace Flow.Launcher.Core.Plugin
1112

1213
internal abstract class PluginConfig
1314
{
14-
private const string PluginConfigName = "plugin.json";
15-
1615
/// <summary>
1716
/// Parse plugin metadata in the given directories
1817
/// </summary>
@@ -52,7 +51,7 @@ public static List<PluginMetadata> Parse(string[] pluginDirectories)
5251

5352
private static PluginMetadata GetPluginMetadata(string pluginDirectory)
5453
{
55-
string configPath = Path.Combine(pluginDirectory, PluginConfigName);
54+
string configPath = Path.Combine(pluginDirectory, Constant.PluginMetadataFileName);
5655
if (!File.Exists(configPath))
5756
{
5857
Log.Error($"|PluginConfig.GetPluginMetadata|Didn't find config file <{configPath}>");

Flow.Launcher.Core/Plugin/PluginInstaller.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using ICSharpCode.SharpZipLib.Zip;
55
using Newtonsoft.Json;
66
using Flow.Launcher.Plugin;
7+
using Flow.Launcher.Infrastructure;
78
using Flow.Launcher.Infrastructure.Logger;
89

910
namespace Flow.Launcher.Core.Plugin
@@ -21,7 +22,7 @@ internal static void Install(string path)
2122
}
2223
UnZip(path, tempFoler, true);
2324

24-
string iniPath = Path.Combine(tempFoler, "plugin.json");
25+
string iniPath = Path.Combine(tempFoler, Constant.PluginMetadataFileName);
2526
if (!File.Exists(iniPath))
2627
{
2728
MessageBox.Show("Install failed: plugin config is missing");
@@ -95,7 +96,7 @@ internal static void Install(string path)
9596

9697
private static PluginMetadata GetMetadataFromJson(string pluginDirectory)
9798
{
98-
string configPath = Path.Combine(pluginDirectory, "plugin.json");
99+
string configPath = Path.Combine(pluginDirectory, Constant.PluginMetadataFileName);
99100
PluginMetadata metadata;
100101

101102
if (!File.Exists(configPath))

Flow.Launcher.Infrastructure/Constant.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public static class Constant
88
{
99
public const string FlowLauncher = "Flow.Launcher";
1010
public const string Plugins = "Plugins";
11+
public const string PluginMetadataFileName = "plugin.json";
1112

1213
public const string ApplicationFileName = FlowLauncher + ".exe";
1314

Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
@@ -17,7 +17,6 @@ namespace Flow.Launcher.Plugin.PluginManagement
1717
public class Main : IPlugin, IPluginI18n
1818
{
1919
private static string APIBASE = "http://api.wox.one";
20-
private static string PluginConfigName = "plugin.json";
2120
private static string pluginSearchUrl = APIBASE + "/plugin/search/";
2221
private const string ListCommand = "list";
2322
private const string InstallCommand = "install";

0 commit comments

Comments
 (0)