mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
fix: support XL_PLATFORM as well (hopefully)
This commit is contained in:
parent
fdbfdbb2cd
commit
30cadef34b
2 changed files with 24 additions and 0 deletions
18
Dalamud.Common/Util/EnvironmentUtils.cs
Normal file
18
Dalamud.Common/Util/EnvironmentUtils.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Dalamud.Common.Util;
|
||||||
|
|
||||||
|
public static class EnvironmentUtils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to get an environment variable using the Try pattern.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="variableName">The env var to get.</param>
|
||||||
|
/// <param name="value">An output containing the env var, if present.</param>
|
||||||
|
/// <returns>A boolean indicating whether the var was present.</returns>
|
||||||
|
public static bool TryGetEnvironmentVariable(string variableName, [NotNullWhen(true)] out string? value)
|
||||||
|
{
|
||||||
|
value = Environment.GetEnvironmentVariable(variableName);
|
||||||
|
return value != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,8 @@ using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using Dalamud.Common;
|
using Dalamud.Common;
|
||||||
using Dalamud.Common.Game;
|
using Dalamud.Common.Game;
|
||||||
|
using Dalamud.Common.Util;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Reloaded.Memory.Buffers;
|
using Reloaded.Memory.Buffers;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
@ -311,6 +313,10 @@ namespace Dalamud.Injector
|
||||||
var unhandledExceptionStr = startInfo.UnhandledException.ToString().ToLowerInvariant();
|
var unhandledExceptionStr = startInfo.UnhandledException.ToString().ToLowerInvariant();
|
||||||
var troubleshootingData = "{\"empty\": true, \"description\": \"No troubleshooting data supplied.\"}";
|
var troubleshootingData = "{\"empty\": true, \"description\": \"No troubleshooting data supplied.\"}";
|
||||||
|
|
||||||
|
// env vars are brought in prior to launch args, since args can override them.
|
||||||
|
if (EnvironmentUtils.TryGetEnvironmentVariable("XL_PLATFORM", out var xlPlatformEnv))
|
||||||
|
platformStr = xlPlatformEnv.ToLowerInvariant();
|
||||||
|
|
||||||
for (var i = 2; i < args.Count; i++)
|
for (var i = 2; i < args.Count; i++)
|
||||||
{
|
{
|
||||||
if (args[i].StartsWith(key = "--dalamud-working-directory="))
|
if (args[i].StartsWith(key = "--dalamud-working-directory="))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue