ProtonUp-Qt icon indicating copy to clipboard operation
ProtonUp-Qt copied to clipboard

Add the hidden ~/.snap/data/steam directory for Steam snap

Open YamiYukiSenpai opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. Right now, it defaults to just ~/snap/steam. I enabled an experimental feature that will allow Snaps to use the hidden ~/.snap/data directory for Snap data.

Describe the solution you'd like In addition to ~/snap/steam, please add ~/.snap/data/steam in the default directory it can read/write to

Describe alternatives you've considered N/A

Additional context https://forum.snapcraft.io/t/experimental-flag-for-hiding-snap/28509 image

YamiYukiSenpai avatar Aug 15 '24 04:08 YamiYukiSenpai

Thanks for reporting. That should be easy to do until the next release. For now, the best solution is to add it as a custom launcher using the button, just like you did.


Considerations for the implementation: There are two possibilities (A) Add it as another/separate launcher (B) Like it is done for native Steam, check which of the two paths and use that for the Snap launcher (preferred method)

DavidoTek avatar Aug 15 '24 12:08 DavidoTek

Considerations for the implementation: There are two possibilities (A) Add it as another/separate launcher (B) Like it is done for native Steam, check which of the two paths and use that for the Snap launcher (preferred method)

I'm guessing that both paths cannot, or at least should not, be valid at the same time then, right? If so, then exactly as you said we should do the same thing that we do for native Steam. I wonder if it's as easy as just adding the Snap paths to POSSIBLE_STEAM_ROOTS. In fact it might also be worth moving the Flatpak Steam path here as well, that way our logic to determine Steam paths and exclude ones which are symlinks is "streamlined" so to speak (might need to reword some of the comments though, or add a comment around the Snap paths specifically).

The existing logic for determining Steam paths takes a list of Steam paths, expands them so that we end up with their real paths (that way any symlinked paths will become duplicates of the paths they are pointing to, i.e. ~/.steam/root might get expanded to ~/.local/share/Steam and so will become a duplicate of that path and will be excluded, so we don't list that path twice). But if there are multiple valid Steam paths we don't exclude them, i.e. if ~/.steam/root was not a duplicate path, we won't exclude it from the possible install locations path here. So if we want to include the Snap and Flatpak paths here, so long as they are unique paths this logic should include them in POSSIBLE_INSTALL_LOCATIONS, and if they don't exist or don't contain the files we need, we handle that in util#is_valid_launcher_installation.

One complication would be setting the type and display_name properly, but I think it's worth making this existing logic flexible to handle multiple Steam installation types.

Also, the Flatpak will need to have the ~/.snap/data path added. Right now we only have access to ~/snap/steam (a specific folder, that is not the same as the hidden .snap folder, I didn't realise at first glance that it was "dot-snap" and not "snap"). That's very straightforward to add though :-)

sonic2kk avatar Aug 22 '24 22:08 sonic2kk

Hmm, looking into this further, I think instead of re-using the Steam Native code path, we should do it in a much more simpler way and just check if ~/.snap/data/Steam exists. If it does, we can use this experimental "Snap data" path to store compatibility tools. Or we could store both and let is_valid_launcher_installation determine which path is valid (though it would need updated to handle Steam Snap, that should be straightforward).

I assume that when this option is enabled, all Steam config and data files get moved to ~/.snap/data/steam and it effectively becomes the installation directory, replacing ~/snap/steam? Based on the fact that it contains local/share/Steam I assume it also contains a config folder and Steams other files.

sonic2kk avatar Aug 22 '24 22:08 sonic2kk

I think instead of re-using the Steam Native code path, we should do it in a much more simpler way and just check if ~/.snap/data/Steam exists. If it does, we can use this experimental "Snap data" path to store compatibility tools Or we could store both and let is_valid_launcher_installation determine which path is valid (though it would need updated to handle Steam Snap, that should be straightforward).

That seems to be the simplest solution.

I assume that when this option is enabled, all Steam config and data files get moved to ~/.snap/data/steam and it effectively becomes the installation directory, replacing ~/snap/steam?

I hope so. The only reason we have the complicated logic for the native Steam is because it wasn't really the case there. But there also were differences based on the distro etc.

@YamiYukiSenpai What happens to ~/snap/steam when the experimental feature is enabled? Is it deleted? Is a symlink created to the new .snap location?

Based on the fact that it contains local/share/Steam I assume it also contains a config folder and Steams other files.

Probably.

@YamiYukiSenpai Can you confirm that the path ~/.snap/data/steam/common/.local/share/Steam/config exists and contains files?

DavidoTek avatar Aug 29 '24 16:08 DavidoTek

@YamiYukiSenpai Can you confirm that the path ~/.snap/data/steam/common/.local/share/Steam/config exists and contains files?

> ls -l ~/.snap/data/steam/common/.local/share/Steam/config
total 76
drwxrwxr-x 1 yamiyuki yamiyuki    42 Aug 28  2023 avatarcache
drwx------ 1 yamiyuki yamiyuki    46 Jul 31 22:44 cefdata
-rwxrwxr-x 1 yamiyuki yamiyuki 34524 Sep  1 02:05 config.vdf
-rw-rw-r-- 1 yamiyuki yamiyuki    21 Aug 27 23:32 DialogConfigOverlay_3440x1440.vdf
-rw-rw-r-- 1 yamiyuki yamiyuki 10108 Aug 27 23:32 DialogConfigOverlay_800x450.vdf
-rw-rw-r-- 1 yamiyuki yamiyuki  7840 Sep  1 02:07 DialogConfig.vdf
drwxrwxr-x 1 yamiyuki yamiyuki   766 Sep  1 02:05 htmlcache
-rwxrwxr-x 1 yamiyuki yamiyuki  2686 Aug 27 22:39 libraryfolders.vdf
-rwxrwxr-x 1 yamiyuki yamiyuki   263 Aug 27 22:39 loginusers.vdf
-rwxrwxr-x 1 yamiyuki yamiyuki   332 Aug  2 14:00 remoteclients.vdf
-rwxrwxr-x 1 yamiyuki yamiyuki   641 Sep  1 02:05 steamapps.vrmanifest
-rwxrwxr-x 1 yamiyuki yamiyuki     0 Aug 27 23:13 virtualgamepadinfo.txt

Yup they're there

@YamiYukiSenpai What happens to ~/snap/steam when the experimental feature is enabled? Is it deleted? Is a symlink created to the new .snap location?

Not automatically, I think. I believe I had to force it by moving it, but I may be remembering it wrong. I noticed just now that the hidden snap data directory is more populated than expected. I'll get back to you on that and test on one of my VMs sometime this week (hopefully).

YamiYukiSenpai avatar Sep 01 '24 13:09 YamiYukiSenpai