Skip to content

Commit

Permalink
Merge pull request #2106 from erri120/redmod-non-steam
Browse files Browse the repository at this point in the history
Skip running redmod on non-Steam installations on Linux
  • Loading branch information
erri120 authored Sep 30, 2024
2 parents b7ab993 + 6fceadb commit fca03f2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Games/NexusMods.Games.RedEngine/RedModDeployTool.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Reflection;
using CliWrap;
using Microsoft.Extensions.Logging;
using NexusMods.Abstractions.GameLocators;
using NexusMods.Abstractions.Games.DTO;
using NexusMods.Abstractions.Games.Stores.Steam;
using NexusMods.Abstractions.Loadouts;
using NexusMods.Games.Generic;
using NexusMods.Paths;
Expand All @@ -13,9 +15,11 @@ public class RedModDeployTool : ITool
{
private readonly GameToolRunner _toolRunner;
private readonly TemporaryFileManager _temporaryFileManager;
private readonly ILogger _logger;

public RedModDeployTool(GameToolRunner toolRunner, TemporaryFileManager temporaryFileManager)
public RedModDeployTool(GameToolRunner toolRunner, TemporaryFileManager temporaryFileManager, ILogger<RedModDeployTool> logger)
{
_logger = logger;
_toolRunner = toolRunner;
_temporaryFileManager = temporaryFileManager;
}
Expand All @@ -42,8 +46,15 @@ public async Task Execute(Loadout.ReadOnly loadout, CancellationToken cancellati
}
else
{
await using var batchPath = await ExtractTemporaryDeployScript();
await _toolRunner.ExecuteAsync(loadout, Cli.Wrap(batchPath.ToString()), true, cancellationToken);
if (loadout.InstallationInstance.LocatorResultMetadata is SteamLocatorResultMetadata)
{
await using var batchPath = await ExtractTemporaryDeployScript();
await _toolRunner.ExecuteAsync(loadout, Cli.Wrap(batchPath.ToString()), true, cancellationToken);
}
else
{
_logger.LogWarning("Skip running redmod, it's only supported for Steam on Linux at the moment");
}
}
}

Expand Down

0 comments on commit fca03f2

Please sign in to comment.