Use hard links for macOS app bundles

Avoid needing to get executable path from MainModule, which broke the game when run with the dotnet command instead of the bin's apphost. Fixes tests.
This commit is contained in:
PJB3005
2025-12-31 18:46:46 +01:00
parent c25f6c5e98
commit dd41a7ce44
2 changed files with 17 additions and 18 deletions

View File

@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Robust.Shared.Utility;
namespace Robust.Shared.ContentPack
@@ -17,20 +15,9 @@ namespace Robust.Shared.ContentPack
/// </summary>
internal static string GetExecutableDirectory()
{
// TODO: remove this shitty hack, either through making it less hardcoded into shared,
// or by making our file structure less spaghetti somehow.
string location;
if (Process.GetCurrentProcess().MainModule is { } mod)
{
location = mod.FileName;
}
else
{
// Fallback in case the above doesn't work ig?
var assembly = typeof(PathHelpers).Assembly;
location = assembly.Location;
}
// Fallback in case the above doesn't work ig?
var assembly = typeof(PathHelpers).Assembly;
var location = assembly.Location;
if (location == string.Empty)
{
// See https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.location?view=net-5.0#remarks