Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for OSX version of Steam #122

Merged
merged 5 commits into from
Jan 28, 2024
Merged
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
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);
}
}
Loading