Skip to content

Commit

Permalink
Merge pull request #122 from halgari/osx-support
Browse files Browse the repository at this point in the history
Adds support for OSX version of Steam
  • Loading branch information
erri120 authored Jan 28, 2024
2 parents b651100 + fe652c1 commit 5115d55
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -57,6 +57,10 @@ jobs:
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=false

- 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
uses: actions/upload-artifact@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions other/GameFinder.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ public static IEnumerable<AbsolutePath> 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!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,20 @@ public void Test_GetDefaultSteamInstallationPaths_Windows()
}

[Fact]
public void Test_GetDefaultSteamInstallationPaths_Unsupported()
public void Test_GetDefaultSteamInstallationPaths_OSX()
{
var fs = new InMemoryFileSystem(new OSInformation(OSPlatform.OSX));

var act = () => SteamLocationFinder.GetDefaultSteamInstallationPaths(fs).ToArray();
act
.Should().ThrowExactly<PlatformNotSupportedException>()
.WithMessage("GameFinder doesn't support the current platform!");
var overlayFileSystem = fs.CreateOverlayFileSystem(
new Dictionary<AbsolutePath, AbsolutePath>(),
new Dictionary<KnownPath, AbsolutePath>
{
{ KnownPath.ProgramFilesX86Directory, fs.GetKnownPath(KnownPath.TempDirectory) },
});

SteamLocationFinder
.GetDefaultSteamInstallationPaths(overlayFileSystem)
.ToArray()
.Should().HaveCount(1);
}
}

0 comments on commit 5115d55

Please sign in to comment.