Skip to content

Commit

Permalink
Merge #3767 Fix mkbundle executable crash
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Feb 18, 2023
2 parents a113bd0 + 9c2b4ce commit 8390a61
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- [GUI] Red highlight for dependencies on missing DLC (#3698 by: HebaruSan; reviewed: techman83)
- [GUI] Clarify mod list saving options, add menu hotkeys (#3771 by: HebaruSan; reviewed: techman83)
- [Multiple] Italian translation and other localization fixes (#3780, #3781 by: frankieorabona, WujekFoliarz, vinix38, Kalessin1; reviewed: HebaruSan)
- [Core] Fix mkbundle executable crash (#3767 by: memchr; reviewed: HebaruSan)

### Bugfixes

Expand Down
12 changes: 12 additions & 0 deletions Core/GameInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8390a61

Please sign in to comment.