Skip to content

Commit

Permalink
Use Data dir directly instead of BattleTech_Data on a Mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
CptMoore committed Dec 28, 2024
1 parent 7d01a47 commit 7df26a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions ModTek.Common/Globals/Paths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,20 @@ internal static class Paths
{
// Common paths

// BATTLETECH/Mods/ModTek/lib/ModTek.Common.dll -> BATTLETECH
// Linux:
// BATTLETECH/Mods/ModTek/lib/ModTek.Common.dll
// BATTLETECH/BattleTech_Data/Managed
// Mac:
// BATTLETECH/BattleTech.app/Contents/Resources/Mods/ModTek/lib/ModTek.Common.dll
// BATTLETECH/BattleTech.app/Contents/Resources/Data/Managed
// run.sh on Mac should create a symlink from BattleTech_Data -> Data
// Windows:
// BATTLETECH\Mods\ModTek\lib\ModTek.Common.dll
// BATTLETECH\BattleTech_Data\Managed
internal static readonly string BaseDirectory = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "..", "..", ".."));
// Mac has Data, but we have a symlink from BattleTech_Data to Data anyway
internal static readonly string ManagedDirectory = Path.Combine(BaseDirectory, "BattleTech_Data", "Managed");
internal static readonly string ManagedDirectory = Path.Combine(BaseDirectory, IsMac ? "Data" : "BattleTech_Data", "Managed");
private static bool IsMac => File.Exists(Path.Combine(BaseDirectory, "Data", "Managed", "Assembly-CSharp.dll"));

internal static readonly string ModsDirectory = Path.Combine(BaseDirectory, "Mods");
internal static readonly string ModTekDirectory = Path.Combine(ModsDirectory, "ModTek");
Expand Down
2 changes: 1 addition & 1 deletion ModTek.Preloader/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fi
# get doorstop settings for linux/mac from the ini (why does doorstop not do this for us?)
doorstop_config() { grep "^${1}=" "${BASEDIR}/doorstop_config.ini" | cut -d= -f2- ; }
doorstop_convert_bool() { sed s@true@1@ | sed s@false@0@ ; }
doorstop_convert_path() { tr '\\' '/' ; }
doorstop_convert_path() { tr '\\' '/' | tr ';' ':' ; }
export DOORSTOP_MONO_DEBUG_ENABLED="$(doorstop_config debug_enabled | doorstop_convert_bool)"
export DOORSTOP_MONO_DEBUG_ADDRESS="$(doorstop_config debug_address)"
export DOORSTOP_MONO_DEBUG_SUSPEND="$(doorstop_config debug_suspend | doorstop_convert_bool)"
Expand Down

0 comments on commit 7df26a4

Please sign in to comment.