DavidoTek / ProtonUp-Qt

Install and manage GE-Proton, Luxtorpeda & more for Steam and Wine-GE & more for Lutris with this graphical user interface.
https://davidotek.github.io/protonup-qt
GNU General Public License v3.0
1.16k stars 39 forks source link

constants: Use constant to determine if Flatpak #418

Closed sonic2kk closed 1 day ago

sonic2kk commented 3 days ago

We use a lot of os.path.exists('/.flatpak-info') calls to determine if we're running inside Flatpak. This can be stored as a constant. Maybe you could consider this a micro-optimisation as we don't call os.path.exists as much anymore, but my main motivation here was readibility.

I didn't test this in Flatpak, please feel free to do so to make sure I didn't screw anything up (or direct me on how to do it :smile:)

Thanks!


P.S. - This touches the dreaded SteamTinkerLaunch ctmod :wink: I have a laptop again (that I installed SteamTinkerLaunch on using ProtonUp-Qt!) so I am planning to tinker around with that ctmod again and make the code a bit less scary.

DavidoTek commented 1 day ago

Thanks!

That makes it very clean. If we ever need it, we could add the variables IS_APPIMAGE and IS_SNAP in the future.