panik4 / RandomParadox

A C++ random scenario and worldmap generator for Paradox Interactive Games, also useable as a maptool for total conversions
GNU General Public License v3.0
30 stars 2 forks source link

Better auto-detection of Steam folder. #5

Open RandiMoth opened 11 months ago

RandiMoth commented 11 months ago

Currently, the folder is assumed to be "D:/Steam/steamapps/common/<game>", unless stated otherwise. However, at least on Windows, it is possible to automatically detect the folder if installed on Steam. In particular, the Steam install folder can be found from registry keys. In particular, it's in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam as the InstallPath key. The Steam installation folder is guaranteed to have steamapps/libraryfolders.vdf. This file can then be used to obtain the path to the folder with the game (Within "apps", "236850", "394360", and "529340" are EU4, HoI4, and Vicky 3 respectively), by taking the "path" value of the library that contains the game and appending /steamapps/common/<game name>/.

I've not checked the similar alternatives on Unix systems existing, and this will also not work if the game isn't installed with Steam, but other means such as Microsoft Store. It's a fairly small change, but it'll be a good QoL change and possibly decrease the amount of people confused.