Skip to content

Commit

Permalink
Allow override of steam install detection
Browse files Browse the repository at this point in the history
  • Loading branch information
bcssov committed Oct 17, 2023
1 parent 4387560 commit 856092b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/IronyModManager.Services/Registrations/SteamDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created : 02-24-2020
//
// Last Modified By : Mario
// Last Modified On : 05-26-2023
// Last Modified On : 10-17-2023
// ***********************************************************************
// <copyright file="SteamDirectory.cs" company="Mario">
// Mario
Expand All @@ -23,6 +23,7 @@
using IronyModManager.DI;
using IronyModManager.Services.Models;
using IronyModManager.Shared;
using IronyModManager.Shared.Configuration;
using Microsoft.Win32;

namespace IronyModManager.Services.Registrations
Expand Down Expand Up @@ -246,6 +247,12 @@ private static string GetSteamOSXRootPath()
/// <returns>System.String.</returns>
private static string GetSteamRootPath()
{
// We're going to use an override if set
var options = DIResolver.Get<IDomainConfiguration>().GetOptions();
if (!string.IsNullOrWhiteSpace(options.Steam.InstallLocationOverride) && Directory.Exists(options.Steam.InstallLocationOverride))
{
return options.Steam.InstallLocationOverride;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return GetSteamOSXRootPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created : 07-24-2022
//
// Last Modified By : Mario
// Last Modified On : 06-26-2023
// Last Modified On : 10-17-2023
// ***********************************************************************
// <copyright file="DomainConfigurationOptions.cs" company="Mario">
// Mario
Expand Down Expand Up @@ -120,6 +120,11 @@ public class Steam
/// <value>The game handler path.</value>
public string GameHandlerPath { get; set; }

/// <summary>
/// Gets or sets the install location override.
/// </summary>
/// <value>The install location override.</value>
public string InstallLocationOverride { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [use game handler].
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created : 04-16-2021
//
// Last Modified By : Mario
// Last Modified On : 06-26-2023
// Last Modified On : 10-17-2023
// ***********************************************************************
// <copyright file="PlatformConfiguration.cs" company="Mario">
// Mario
Expand Down Expand Up @@ -101,6 +101,7 @@ private DomainConfigurationOptions GetDomainOptions()
{
domainConfiguration.Steam.GameHandlerPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, domainConfiguration.Steam.GameHandlerPath);
}
domainConfiguration.Steam.InstallLocationOverride = steamSection.GetSection("InstallLocationOverride").Get<string>();
domainConfiguration.Formatting.UseSystemCulture = configuration.GetSection("Formatting").GetSection("UseSystemCulture").Get<bool>();
domainConfiguration.ConflictSolver.UseHybridMemory = configuration.GetSection("ConflictSolver").GetSection("UseHybridMemory").Get<bool>();
domainConfiguration.ConflictSolver.UseDiskSearch = configuration.GetSection("ConflictSolver").GetSection("UseDiskSearch").Get<bool>();
Expand Down
3 changes: 2 additions & 1 deletion src/IronyModManager/appSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"Steam": {
"UseLegacyLaunchMethod": false,
"UseGameHandler": true,
"GameHandlerPath": "IronyModManager.GameHandler.exe"
"GameHandlerPath": "IronyModManager.GameHandler.exe",
"InstallLocationOverride": null
},
"Formatting": {
"UseSystemCulture": true
Expand Down

0 comments on commit 856092b

Please sign in to comment.