From 86b20442a21e809b5b8975405337980bf94fe8f0 Mon Sep 17 00:00:00 2001 From: Harry Date: Sat, 23 Sep 2017 16:56:25 +0200 Subject: [PATCH] Fix error in case glade.sh is not found (#9) --- .../GladeDesktopApplication.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/Addins/MonoDevelop.GtkSharp.Addin/GladeDesktopApplication.cs b/Source/Addins/MonoDevelop.GtkSharp.Addin/GladeDesktopApplication.cs index df6e38158..6565857ef 100644 --- a/Source/Addins/MonoDevelop.GtkSharp.Addin/GladeDesktopApplication.cs +++ b/Source/Addins/MonoDevelop.GtkSharp.Addin/GladeDesktopApplication.cs @@ -8,7 +8,22 @@ namespace MonoDevelop.GtkSharp.Addin { public class GladeDesktopApplication : DesktopApplication { - private static readonly string s_unixgladeapp = "-c '" + File.ReadAllText("glade.sh") + "'"; + private static readonly string s_unixgladeapp; + + static GladeDesktopApplication() + { + try + { + var assembly = typeof(GladeDesktopApplication).Assembly.Location; + var gladesh = Path.Combine(Path.GetDirectoryName(assembly), "glade.sh"); + + s_unixgladeapp = "-c '" + File.ReadAllText(gladesh) + "'"; + } + catch (Exception ex) + { + Console.WriteLine(ex); + } + } private readonly string _filename;