It's complicated. This is what I do:
https://github.com/Marginal/EDMarketConnector/blob/master/monitor.py#L287
But this code assumes that the user is playing Horizons, if both Horizons and Season 1 are present. And that they're playing through Steam, if both Steam and non-Steam installations are present. You could get more fancy and compare timestamps if you don't want to make similar assumptions.
Some good ideas here, thanks!
I have some very similar code (whipped up last night) but am not using the registry for any specifics .. yet. My installation is in fact in a custom location so I also implemented a depth 2-3 scan of all folders on all fixed drives, starting from C: and stopping if I get any hits. This finds my installation very quickly and does not scan my 4 extra data drives (3x1TB, 1x2TB) which would be pointless.
From what I can make out (I have never used python myself) you build a list of candidates from the following:
- Look in the windows registry for steam, parse the VDF file, find the BaseInstallFolder_
- Look in the windows registry for the frontier installed product and get the InstallLocation
- Include the other default locations
Then you check each candidate for known product name/format folders and those for \Logs and \AppConfig.xml
I don't suppose this handles cases where you're using an alternate steamapps folder? I have an SSD and use C:\Games\Steam for my steamapps folder. Steam itself is installed in C:\Program Files..
While I have your attention.. I noticed that you don't encode some of the information you store.. you know what I mean. You really should
