diff --git a/Robust.Shared/ContentPack/PathHelpers.cs b/Robust.Shared/ContentPack/PathHelpers.cs index 8d1267a85..64ffaee3c 100644 --- a/Robust.Shared/ContentPack/PathHelpers.cs +++ b/Robust.Shared/ContentPack/PathHelpers.cs @@ -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 /// 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 diff --git a/Tools/macos_make_appbundle.py b/Tools/macos_make_appbundle.py index a5c3e6b21..4d2f0be3c 100755 --- a/Tools/macos_make_appbundle.py +++ b/Tools/macos_make_appbundle.py @@ -98,9 +98,21 @@ def symlink_files(src_dir: str, dest_dir: str, relative: str): if not symlinkable_re.match(file): continue + src_path = p(src_dir, file) dest_symlink = p(dest_dir, file) - if not os.path.islink(dest_symlink): - os.symlink(f"../../../{relative}{file}", dest_symlink) + if os.path.isdir(src_path): + # Symlink directories + if not os.path.islink(dest_symlink): + os.symlink(f"../../../{relative}{file}", dest_symlink) + else: + # Hardlink files + # (so that .NET doesn't report the real file path for assembly locations) + try: + os.remove(dest_symlink) + except FileNotFoundError: + pass # Fine + + os.link(src_path, dest_symlink) main()