diff --git a/src/Greenshot.Base/Core/EnvironmentInfo.cs b/src/Greenshot.Base/Core/EnvironmentInfo.cs
index 30811fb69..0d163326e 100644
--- a/src/Greenshot.Base/Core/EnvironmentInfo.cs
+++ b/src/Greenshot.Base/Core/EnvironmentInfo.cs
@@ -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();
}
+
+ ///
+ /// Returns the directory where the application is located
+ ///
+ public static string GetApplicationFolder()
+ => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
///
diff --git a/src/Greenshot.Base/Core/Language.cs b/src/Greenshot.Base/Core/Language.cs
index 4627a10fc..8794ff54d 100644
--- a/src/Greenshot.Base/Core/Language.cs
+++ b/src/Greenshot.Base/Core/Language.cs
@@ -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)
diff --git a/src/Greenshot.Editor/Controls/Emoji/EmojiData.cs b/src/Greenshot.Editor/Controls/Emoji/EmojiData.cs
index cec1a532d..8b634f684 100644
--- a/src/Greenshot.Editor/Controls/Emoji/EmojiData.cs
+++ b/src/Greenshot.Editor/Controls/Emoji/EmojiData.cs
@@ -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
///
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();
diff --git a/src/Greenshot.Editor/Drawing/Emoji/EmojiRenderer.cs b/src/Greenshot.Editor/Drawing/Emoji/EmojiRenderer.cs
index af31e0173..fa50059a1 100644
--- a/src/Greenshot.Editor/Drawing/Emoji/EmojiRenderer.cs
+++ b/src/Greenshot.Editor/Drawing/Emoji/EmojiRenderer.cs
@@ -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 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?");