Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tanji.Infrastructure/Configuration/PlatformPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public readonly record struct PlatformPaths
public readonly string RootPath { get; init; }
public required string ClientPath { get; init; }
public required string ExecutablePath { get; init; }
public required Int32 Version { get; init; }
}
17 changes: 15 additions & 2 deletions Tanji.Infrastructure/Configuration/PostConfigureTanjiOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Tanji.Infrastructure.Json;

using Microsoft.Extensions.Options;
using System.Diagnostics;

namespace Tanji.Infrastructure.Configuration;

Expand All @@ -30,13 +31,25 @@ public void PostConfigure(string? name, TanjiOptions options)

foreach (Installation installation in options.Versions.Installations)
{
if (platformPaths.ContainsKey(installation.Platform))
{
if(platformPaths[installation.Platform].Version < int.Parse(installation.Version))
{
platformPaths.Remove(installation.Platform);
}
else
{
continue;
}
}

platformPaths.Add(installation.Platform, new PlatformPaths
{
Platform = installation.Platform,

RootPath = installation.Path,
ClientPath = Path.Combine(installation.Path, PlatformConverter.ToClientName(installation.Platform)),
ExecutablePath = Path.Combine(installation.Path, PlatformConverter.ToExecutableName(installation.Platform))
ExecutablePath = Path.Combine(installation.Path, PlatformConverter.ToExecutableName(installation.Platform)),
Version = int.Parse(installation.Version)
});
}
}
Expand Down