Repository: lutris/lutris

Issue:
Lutris isn't detecting all wine versions
**Describe the bug**

Lutris seems to randomly decide when to detect all wine versions


**Expected behavior**

Being able to select any of my wine versions when I go to the configuration options in Lutris

Please describe the behavior you are expecting.

Some of them aren't shown. Then a couple will show back up, but when I delete them they STILL show up. 

What is the current behavior?

add a custom wine version to `~/.local/share/lutris/runners/wine`
restart Lutris, or start it if it wasn't already running
Go into configuration for a game using Wine and select the version drop-down.


*Also, People have told me that Lutris also checks Steam for installed Wine/Proton versions, however I've never been able to get it to work, Lutris never lists wine versions unless I have them in `~/.local/share/lutris/runners/wine` (See [here](https://www.reddit.com/r/linux_gaming/comments/d74tqy/call_of_duty_modern_warfare_2019_testing/fakuijf/?context=3) )

This has happened with multiple builds from GloriousEggroll and TK-Glitch


Discussion:
I can't reproduce this, all of my custom builds show up in the menu just fine after I restart them.
Please provide the builds themselves, and perhaps record a video that shows how you install them.
Here's a video of me showing two of Tk-Glitch's proton builds in `~/.steam/root/compatibilitytools.d/` and them not showing up in Lutris. I had already restarted Lutris before recording, as I know you always have to restart when you add wine versions. The custom WINE versions always show up if I put them specifically in `~/.local/share/lutris/runners/wine/`, however custom proton builds do not, unless I symlink everything in the `dist` folder into the main folder (`/bin, /lib, /lib64, /share, /include`). Was I told that lutris is supposed to automatically detect wine builds in `~/.steam/root/compatibilitytools.d` in error? Also, I'm trying to reproduce a video of a custom wine version not showing up even when placed in `~/.local/share/lutris/runners/wine`, but I need to compile a new custom wine version first. Will post when I have it. 

https://imgur.com/a/p0p0Nj8

I can't get Lutris to find anything under `/compatibilitytools.d` as far as I can tell. Exit Lutris, exit Steam, extract Proton-5.0-GE-1. Launch Steam, runner shows up in the list, launch and play a game with it just to be sure, launch Lutris. Proton-5.0-GE-1 is not listed under runners when configuring a game, Manage Runners from the main menu, or in "Manage wine versions". Doesn't seem to work if I put it anywhere under `/.local/share/lutris/runners` either.
@Techbane you can get it to show up in Lutris, just not the way it says you can. It definitely doesn't read proton directories in `compatibilitytools.d`. You have to do what I said above:
`ln -s /home/$USER/.steam/root/compatibilitytools.d/Proton-5.0-GE-1/dist /home/$USER/.local/share/lutris/runners/wine/Proton-5.0-GE-1`

If you do that exact command, and restart lutris, it'll show up. It's not supposed to show up in "Manage Runners" or "Manage Wine Versions," but it will in fact show up in the dropdown list of wine versions when configuring a game

@tannisroot can you seriously not reproduce this? So you're telling me that you can place a custom proton build into `~/.steam/root/compatibilitytools.d/` and lutris will recognize it? Because no matter what I do, Lutris only recognizes wine/proton versions if they're in `~/.local/share/lutris/runners/wine`, or at least symlinked to it. 
> @Techbane you can get it to show up in Lutris, just not the way it says you can. It definitely doesn't read proton directories in `compatibilitytools.d`. You have to do what I said above:
> `ln -s /home/$USER/.steam/root/compatibilitytools.d/Proton-5.0-GE-1/dist /home/$USER/.local/share/lutris/runners/wine/Proton-5.0-GE-1`
> 
> If you do that exact command, and restart lutris, it'll show up. It's not supposed to show up in "Manage Runners" or "Manage Wine Versions," but it will in fact show up in the dropdown list of wine versions when configuring a game

I have had a similar problem with GloriousEggroll Proton (proton-ge-custom) installed from Arch AUR repo. However, it is installed to /usr/share/steam/compatibilitytools.d/5.2-GE-2/
Following the above symlink instructions (but changing to allow for above path), it now shows up correctly in Lutris.
Granted, this may be a bit more niche as that's the only version of Proton I've installed that's gone into /usr/share/...
@ThornedRose does Lutris detect your proton builds that are in `~/.steam/root/compatibilitytoolsd./`? For me it ONLY detects builds that are in `~/.local/share/lutris/runners/wine/`, or at least symlinked into that directory. 
@strycore do you mind an additional PR for system-wide Steam compatibilitytools.d locations?
not at all
Ok, then I'll push a new PR with the system-wide locations that have been added after https://github.com/ValveSoftware/steam-for-linux/issues/6310.

Resolving patch:
diff --git a/lutris/runners/steam.py b/lutris/runners/steam.py
--- a/lutris/runners/steam.py
+++ b/lutris/runners/steam.py
@@ -139,6 +139,8 @@ class steam(Runner):
     system_options_override = [{"option": "disable_runtime", "default": True}]
 
     data_dir_candidates = (
+        "/usr/share/steam",
+        "/usr/local/share/steam",
         "~/.steam",
         "~/.local/share/steam",
         "~/.steam/steam",
@@ -242,6 +244,9 @@ def get_game_path_from_appid(self, appid):
     def get_steamapps_dirs(self):
         """Return a list of the Steam library main + custom folders."""
         dirs = []
+        # Extra colon-separated compatibility tools dirs environment variable
+        if 'STEAM_EXTRA_COMPAT_TOOLS_PATHS' in os.environ:
+            dirs += os.getenv('STEAM_EXTRA_COMPAT_TOOLS_PATHS').split(':')
         # Main steamapps dir and compatibilitytools.d dir
         for data_dir in self.data_dir_candidates:
             for _dir in ["SteamApps", "compatibilitytools.d"]:


Test patch: