Skip to content

Commit

Permalink
fix some issues figuring out gmod arch on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Earu committed Oct 11, 2024
1 parent 1326c7e commit 0061a5c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions GmodInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Microsoft.Win32;
using Spectre.Console;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using VdfParser;

Expand Down Expand Up @@ -101,6 +100,7 @@ private static bool TryGetMountedBeta(out bool isX64)
dynamic result = deserializer.Deserialize(gmodManifestFile);

isX64 = result?.AppState?.UserConfig?.BetaKey == "x86-64";
return true;
}
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ internal static bool TryGetGmodPath(out string gmodPath, bool toBin = true)
}
}

LocalLogger.WriteLine("Could not find Gmod directory: Maybe it's not installed?");
LocalLogger.WriteLine("Could not find Gmod directory: Maybe it's not installed or installed via steamcmd?");
gmodPath = string.Empty;
return false;
}
Expand All @@ -233,8 +233,7 @@ private static string GetBinaryFileName(bool isX64)
}
else
{
// always x64 as well
moduleName += "linux64";
moduleName += isX64 ? "linux64" : "linux";
}

moduleName += ".dll";
Expand Down Expand Up @@ -270,7 +269,9 @@ private static async Task<bool> InstallBinary(bool isX64, string luaBinPath)
private static bool IsGmodX64(string gmodBinPath)
{
// Base assumption in case it fails later (windows can do x86 and x64, linux/mac only x64)
bool isX64 = !RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || gmodBinPath.Contains("win64", StringComparison.CurrentCulture);
bool isX64 = RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
|| gmodBinPath.Contains("win64", StringComparison.CurrentCulture)
|| gmodBinPath.Contains("linux64", StringComparison.CurrentCulture);

// Fetch the gmod manifest to make a safer assumption of the current branch
if (TryGetMountedBeta(out bool isBetaX64))
Expand Down

0 comments on commit 0061a5c

Please sign in to comment.