mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 22:13:23 -07:00
Fix .xml loading
This commit is contained in:
parent
50fb6e65ab
commit
b12ace28e4
4 changed files with 12 additions and 5 deletions
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
@ -265,6 +266,12 @@ namespace Greenshot.Base.Core
|
|||
|
||||
return exceptionText.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the directory where the application is located
|
||||
/// </summary>
|
||||
public static string GetApplicationFolder()
|
||||
=> Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Greenshot.Base.Core
|
|||
|
||||
try
|
||||
{
|
||||
string applicationFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
string applicationFolder = EnvironmentInfo.GetApplicationFolder();
|
||||
|
||||
// PAF Path
|
||||
if (applicationFolder != null)
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using Greenshot.Base.Core;
|
||||
|
||||
namespace Greenshot.Editor.Controls.Emoji
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ namespace Greenshot.Editor.Controls.Emoji
|
|||
/// </summary>
|
||||
public static class EmojiData
|
||||
{
|
||||
private const string EmojisXmlFilePath = "emojis.xml";
|
||||
private static readonly string EmojisXmlFilePath = Path.Combine(EnvironmentInfo.GetApplicationFolder(), "emojis.xml");
|
||||
|
||||
public static Emojis Data { get; private set; } = new();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Reflection;
|
||||
using Greenshot.Base.Core;
|
||||
using SixLabors.Fonts;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Drawing.Processing;
|
||||
|
@ -41,8 +42,7 @@ namespace Greenshot.Editor.Drawing.Emoji
|
|||
|
||||
private static readonly Lazy<FontFamily> TwemojiFontFamily = new(() =>
|
||||
{
|
||||
var exeDirectory = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
|
||||
var twemojiFontFile = Path.Combine(exeDirectory, "Twemoji.Mozilla.ttf");
|
||||
var twemojiFontFile = Path.Combine(EnvironmentInfo.GetApplicationFolder(), "Twemoji.Mozilla.ttf");
|
||||
if (!File.Exists(twemojiFontFile))
|
||||
{
|
||||
throw new FileNotFoundException($"Can't find {twemojiFontFile}, bad installation?");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue