From 52c56e44ecde178a89b3da9d74eaf28fa1a39c96 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Thu, 25 Jan 2024 21:53:36 -0700 Subject: [PATCH 1/5] Adds support for OSX version of Steam --- .../Services/SteamLocationFinder.cs | 9 +++++++++ .../Services/SteamLocationFinderTests.cs | 15 +++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/GameFinder.StoreHandlers.Steam/Services/SteamLocationFinder.cs b/src/GameFinder.StoreHandlers.Steam/Services/SteamLocationFinder.cs index 8feecae9..d71ec254 100644 --- a/src/GameFinder.StoreHandlers.Steam/Services/SteamLocationFinder.cs +++ b/src/GameFinder.StoreHandlers.Steam/Services/SteamLocationFinder.cs @@ -214,6 +214,15 @@ public static IEnumerable GetDefaultSteamInstallationPaths(IFileSy yield break; } + if (fileSystem.OS.IsOSX) + { + // ~/Library/Application Support/Steam + yield return fileSystem.GetKnownPath(KnownPath.LocalApplicationDataDirectory) + .Combine("Steam"); + + yield break; + } + throw new PlatformNotSupportedException("GameFinder doesn't support the current platform!"); } } diff --git a/tests/GameFinder.StoreHandlers.Steam.Tests/Services/SteamLocationFinderTests.cs b/tests/GameFinder.StoreHandlers.Steam.Tests/Services/SteamLocationFinderTests.cs index 4314d0de..3e65471e 100644 --- a/tests/GameFinder.StoreHandlers.Steam.Tests/Services/SteamLocationFinderTests.cs +++ b/tests/GameFinder.StoreHandlers.Steam.Tests/Services/SteamLocationFinderTests.cs @@ -155,9 +155,16 @@ public void Test_GetDefaultSteamInstallationPaths_Unsupported() { var fs = new InMemoryFileSystem(new OSInformation(OSPlatform.OSX)); - var act = () => SteamLocationFinder.GetDefaultSteamInstallationPaths(fs).ToArray(); - act - .Should().ThrowExactly() - .WithMessage("GameFinder doesn't support the current platform!"); + var overlayFileSystem = fs.CreateOverlayFileSystem( + new Dictionary(), + new Dictionary + { + { KnownPath.ProgramFilesX86Directory, fs.GetKnownPath(KnownPath.TempDirectory) }, + }); + + SteamLocationFinder + .GetDefaultSteamInstallationPaths(overlayFileSystem) + .ToArray() + .Should().HaveCount(1); } } From b89a09e8da63f604566962133ef6176503f26e6a Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Thu, 25 Jan 2024 21:56:11 -0700 Subject: [PATCH 2/5] Update the example to show it works --- other/GameFinder.Example/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/other/GameFinder.Example/Program.cs b/other/GameFinder.Example/Program.cs index 1a73f2c7..dfaa61e5 100644 --- a/other/GameFinder.Example/Program.cs +++ b/other/GameFinder.Example/Program.cs @@ -133,6 +133,12 @@ private static void Run(Options options, ILogger logger) if (options.Xbox) RunXboxHandler(wineFileSystem); } } + + if (OperatingSystem.IsMacOS()) + { + if (options.Steam) + RunSteamHandler(realFileSystem, null); + } } private static void RunGOGHandler(IRegistry registry, IFileSystem fileSystem) From d638bb417ac431a7a0b8605b7b415726fa13c55a Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Thu, 25 Jan 2024 21:58:27 -0700 Subject: [PATCH 3/5] Add OSX to the ci.yaml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bed3621..465112b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macos-latest, macos-13] env: OS: ${{ matrix.os }} From ec48304003710a9137a7940b4e440ad2a1041933 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Sat, 27 Jan 2024 13:50:35 -0700 Subject: [PATCH 4/5] Handle PR feedback --- .github/workflows/ci.yml | 4 ++++ .../Services/SteamLocationFinderTests.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 465112b8..bcf9db2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,10 @@ jobs: - name: Publish (Windows) if: runner.os == 'Windows' + run: dotnet publish other/GameFinder.Example/GameFinder.Example.csproj -o ${{ github.workspace }}/bin/${{ runner.os }} -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=fal + + - name: Publish (macOS) + if: runner.os == 'macOS' run: dotnet publish other/GameFinder.Example/GameFinder.Example.csproj -o ${{ github.workspace }}/bin/${{ runner.os }} -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=false - name: Upload Artifact diff --git a/tests/GameFinder.StoreHandlers.Steam.Tests/Services/SteamLocationFinderTests.cs b/tests/GameFinder.StoreHandlers.Steam.Tests/Services/SteamLocationFinderTests.cs index 3e65471e..839a05ac 100644 --- a/tests/GameFinder.StoreHandlers.Steam.Tests/Services/SteamLocationFinderTests.cs +++ b/tests/GameFinder.StoreHandlers.Steam.Tests/Services/SteamLocationFinderTests.cs @@ -151,7 +151,7 @@ public void Test_GetDefaultSteamInstallationPaths_Windows() } [Fact] - public void Test_GetDefaultSteamInstallationPaths_Unsupported() + public void Test_GetDefaultSteamInstallationPaths_OSX() { var fs = new InMemoryFileSystem(new OSInformation(OSPlatform.OSX)); From fe652c1d98a3f6741851e6abe2f4118c27a9cd84 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Sat, 27 Jan 2024 14:34:43 -0700 Subject: [PATCH 5/5] Update ci.yml Fix a typeo, not sure how that got in --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcf9db2e..722fec8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: - name: Publish (Windows) if: runner.os == 'Windows' - run: dotnet publish other/GameFinder.Example/GameFinder.Example.csproj -o ${{ github.workspace }}/bin/${{ runner.os }} -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=fal + run: dotnet publish other/GameFinder.Example/GameFinder.Example.csproj -o ${{ github.workspace }}/bin/${{ runner.os }} -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=false - name: Publish (macOS) if: runner.os == 'macOS'