Avoid created the user's custom cache dir- we should only create our own private one if missing.

This commit is contained in:
Daniel Johnson 2024-01-02 04:46:57 -05:00
parent 70c483d8ff
commit a3c237b21f
2 changed files with 7 additions and 8 deletions

View file

@ -3,8 +3,7 @@ import os
from gettext import gettext as _
from urllib.parse import urlparse
from lutris import cache
from lutris.cache import has_custom_cache_path, save_to_cache
from lutris.cache import get_cache_path, has_custom_cache_path, save_to_cache
from lutris.gui.widgets.download_progress_box import DownloadProgressBox
from lutris.installer.errors import ScriptingError
from lutris.util import system
@ -186,7 +185,7 @@ class InstallerFile:
@property
def cache_path(self):
"""Return the directory used as a cache for the duration of the installation"""
_cache_path = cache.get_cache_path()
_cache_path = get_cache_path()
url_parts = urlparse(self.url)
if url_parts.netloc.endswith("gog.com"):
folder = "gog"
@ -195,8 +194,9 @@ class InstallerFile:
return os.path.join(_cache_path, self.game_slug, folder)
def prepare(self):
"""Prepare the file for download, if we've not been redirected to an existing file."""
if not self._dest_file and not system.path_exists(self.cache_path):
"""Prepare the file for download. If we've not been redirected to an existing file,
and if we're using our own installer cache, we need to unsure that directory exists."""
if not self._dest_file and not has_custom_cache_path() and not os.path.isdir(self.cache_path):
os.makedirs(self.cache_path)
def create_download_progress_box(self):

View file

@ -3,8 +3,7 @@ import os
from gettext import gettext as _
from urllib.parse import urlparse
from lutris import cache
from lutris.cache import has_custom_cache_path
from lutris.cache import get_cache_path, has_custom_cache_path
from lutris.gui.widgets.download_collection_progress_box import DownloadCollectionProgressBox
from lutris.util import system
from lutris.util.strings import gtk_safe_urls
@ -122,7 +121,7 @@ class InstallerFileCollection:
@property
def cache_path(self):
"""Return the directory used as a cache for the duration of the installation"""
_cache_path = cache.get_cache_path()
_cache_path = get_cache_path()
return os.path.join(_cache_path, self.game_slug)
def prepare(self):