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:
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 usingxdg.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: