Coder Social home page Coder Social logo

Comments (5)

erri120 avatar erri120 commented on July 1, 2024

I should have probably put this in the readme somewhere. In 1.6.4 I added support for Steam on Linux by changing the project file and adding some conditional code:

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
<ProjectReference Include="..\GameFinder.RegistryUtils\GameFinder.RegistryUtils.csproj" />
</ItemGroup>

#if Windows
using var steamKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(SteamRegKey);
if (steamKey == null)
{
Logger.LogError("Unable to open registry key {SteamKey}", steamKey);
return;
}
var steamPath = RegistryUtils.RegistryHelper.GetStringValueFromRegistry(steamKey, "SteamPath", Logger);
if (steamPath == null) return;
if (!Directory.Exists(steamPath))
{
Logger.LogError("Path to Steam from Registry does not exist: {SteamPath}", steamPath);
return;
}
#else
var steamPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".steam", "steam");
if (!Directory.Exists(steamPath))
{
Logger.LogError("Default Steam path for Unix systems does not exist: {SteamPath}", steamPath);
return;
}
#endif

The idea is to use net5.0 if you are on Linux, in which case you either provide the path to the Steam folder or it will look for it in ~/steam/steam, or net5.0-windows which will also load the GameFinder.RegistryUtils lib and look for the Steam path in the registry.

from gamefinder.

halgari avatar halgari commented on July 1, 2024

from gamefinder.

erri120 avatar erri120 commented on July 1, 2024

The problem is that on Windows you'd need access to the registry and that comes from Microsoft.Win32.Registry which does not work on net5.0 or net6.0 and requries net5.0-windows or net6.0-windows. For unit tests I would recommend using the net5.0 package and making use of the other constructor where you can pass the location of Steam. You know where this is located on the build server so you don't need the registry to locate Steam.

I will also look at adding net6.0 as a target framework to the packages.

from gamefinder.

halgari avatar halgari commented on July 1, 2024

from gamefinder.

erri120 avatar erri120 commented on July 1, 2024

Should be resolved in 2.0.0

from gamefinder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.