Skip to content

Commit c661b7e

Browse files
committed
window stategy is default engine for virtual stategy on windows
1 parent 0debff8 commit c661b7e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/PetroglyphTools/PG.StarWarsGame.Engine.FileSystem/IO/PetroglyphFileSystem.Strategies.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ public sealed partial class PetroglyphFileSystem
4141
/// <param name="windowsFallback">
4242
/// <see langword="true" /> to delegate outside-game-directory lookups to the Windows
4343
/// <c>CreateFileA</c> strategy; <see langword="false" /> to delegate them to the Wine search
44-
/// engine, which works on every host.
44+
/// engine; <see langword="null" /> to pick the Windows strategy on Windows hosts and the Wine
45+
/// strategy otherwise.
4546
/// </param>
4647
/// <exception cref="PlatformNotSupportedException">
4748
/// <paramref name="windowsFallback"/> is <see langword="true" /> and the host is not Windows.
4849
/// </exception>
49-
public void UseVirtualStrategy(bool windowsFallback = false)
50+
public void UseVirtualStrategy(bool? windowsFallback = null)
5051
{
51-
FileExistsStrategy fallback = windowsFallback
52+
var useWindows = windowsFallback ?? RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
53+
FileExistsStrategy fallback = useWindows
5254
? CreateWindowsStrategy()
5355
: new WineFileExistsStrategy(_underlyingFileSystem);
5456
UseVirtualStrategy(fallback);

0 commit comments

Comments
 (0)