diff --git a/Core/GameInstance.cs b/Core/GameInstance.cs index 98d918c328..8cf0ef2e8b 100644 --- a/Core/GameInstance.cs +++ b/Core/GameInstance.cs @@ -5,6 +5,8 @@ using System.Reflection; using System.Text.RegularExpressions; using System.Transactions; +using System.Diagnostics; + using ChinhDo.Transactions.FileManager; using log4net; using Newtonsoft.Json; @@ -241,6 +243,16 @@ public static string PortableDir(IGame game) // Find the directory our executable is stored in. string exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + if (string.IsNullOrEmpty(exeDir)) + { + exeDir = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); + if (string.IsNullOrEmpty(exeDir)) + { + log.InfoFormat("Executing assembly path and main module path not found"); + return null; + } + log.InfoFormat("Executing assembly path not found, main module path is {0}", exeDir); + } log.DebugFormat("Checking if {0} is in my exe dir: {1}", game.ShortName, exeDir);