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.17k stars 39 forks source link

constants: store HOME_DIR instead of calling os.path.expanduser #281

Closed sonic2kk closed 10 months ago

sonic2kk commented 10 months ago

Noticed this when poking my nose around the codebase. I'm sure there are other examples but this is just a very minor improvement imo. Instead of calling os.path.expanduser('~') to get the home directory, we store it as a constant, the same way we store some other constant paths (like the configpath, or temp dir path).

I originally planned to include a change from using os.getenv('XDG_CACHE_HOME') to using xdg.BaseDirectory.xdg_cache_home but this would introduce a behaviour change, since PyXDG falls back to ~/.cache.

This doesn't offer any speedups but looks cleaner than using os.path.expanduser('~') imo (and might help readibility).

os.path.expanduser is used in other places, mainly to expand install and config folders to ensure we have the full path, but I didn't touch those in this PR. :slightly_smiling_face: