mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
refactor logging in Core.Plugin.PluginInstaller
This commit is contained in:
parent
a3374f2383
commit
2fd318fcbf
1 changed files with 6 additions and 21 deletions
|
|
@ -1,9 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using ICSharpCode.SharpZipLib.Zip;
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Flow.Launcher.Plugin;
|
using Flow.Launcher.Plugin;
|
||||||
|
using Flow.Launcher.Infrastructure.Logger;
|
||||||
|
|
||||||
namespace Flow.Launcher.Core.Plugin
|
namespace Flow.Launcher.Core.Plugin
|
||||||
{
|
{
|
||||||
|
|
@ -107,36 +108,20 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
||||||
metadata.PluginDirectory = pluginDirectory;
|
metadata.PluginDirectory = pluginDirectory;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
string error = $"Parse plugin config {configPath} failed: json format is not valid";
|
Log.Exception($"|PluginInstaller.GetMetadataFromJson|plugin config {configPath} failed: invalid json format", e);
|
||||||
#if (DEBUG)
|
|
||||||
{
|
|
||||||
throw new Exception(error);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!AllowedLanguage.IsAllowed(metadata.Language))
|
if (!AllowedLanguage.IsAllowed(metadata.Language))
|
||||||
{
|
{
|
||||||
string error = $"Parse plugin config {configPath} failed: invalid language {metadata.Language}";
|
Log.Error($"|PluginInstaller.GetMetadataFromJson|plugin config {configPath} failed: invalid language {metadata.Language}");
|
||||||
#if (DEBUG)
|
|
||||||
{
|
|
||||||
throw new Exception(error);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!File.Exists(metadata.ExecuteFilePath))
|
if (!File.Exists(metadata.ExecuteFilePath))
|
||||||
{
|
{
|
||||||
string error = $"Parse plugin config {configPath} failed: ExecuteFile {metadata.ExecuteFilePath} didn't exist";
|
Log.Error($"|PluginInstaller.GetMetadataFromJson|plugin config {configPath} failed: file {metadata.ExecuteFilePath} doesn't exist");
|
||||||
#if (DEBUG)
|
|
||||||
{
|
|
||||||
throw new Exception(error);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue