Skip to content

Commit

Permalink
refactor: remove function deleting obsolete ULWGL files on launch
Browse files Browse the repository at this point in the history
- This was only appropriate to do going from pre-release to stable release, and, at this point, most users are expected to not have any ULWGL files. However, for future releases, calling this function to clean up a new set of obsolete files will not be ok due to the risk of breaking other applications that do not use the Lutris API to acquire it automatically
  • Loading branch information
R1kaB3rN committed Nov 24, 2024
1 parent e5ecf7e commit 3aee061
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
4 changes: 1 addition & 3 deletions umu/umu_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from umu.umu_consts import CONFIG, UMU_CACHE, UMU_LOCAL
from umu.umu_log import log
from umu.umu_util import find_obsolete, https_connection, run_zenity
from umu.umu_util import https_connection, run_zenity

try:
from tarfile import tar_filter
Expand Down Expand Up @@ -266,8 +266,6 @@ def setup_umu(
log.debug("Runtime Platform updates disabled")
return

find_obsolete()

with https_connection(host) as client_session:
_update_umu(local, json, thread_pool, client_session)

Expand Down
45 changes: 1 addition & 44 deletions umu/umu_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
from pathlib import Path
from re import Pattern
from re import compile as re_compile
from shutil import rmtree, which
from shutil import which
from ssl import SSLContext, create_default_context
from subprocess import PIPE, STDOUT, Popen, TimeoutExpired

from filelock import FileLock
from Xlib import display

from umu.umu_consts import STEAM_COMPAT, UMU_LOCAL
from umu.umu_log import log

ssl_context: SSLContext | None = None
Expand Down Expand Up @@ -174,47 +172,6 @@ def is_winetricks_verb(
return True


def find_obsolete() -> None:
"""Find obsoleted launcher files and log them."""
home: Path = Path.home()
obsoleted: set[str] = {
"reaper",
"sniper_platform_0.20240125.75305",
"BUILD_ID.txt",
"umu_version.json",
"sniper_platform_0.20231211.70175",
}
launcher: Path
lock: FileLock = FileLock(f"{UMU_LOCAL}/umu.lock")

with lock:
# Obsoleted files in $HOME/.local/share/umu from RC4 and below
for file in UMU_LOCAL.glob("*"):
is_umu_file: bool = file.name.endswith(".py") and (
file.name.startswith(("umu", "ulwgl"))
)
if is_umu_file or file.name in obsoleted:
if file.is_file():
file.unlink()
if file.is_dir():
rmtree(str(file))

# $HOME/.local/share/Steam/compatibilitytool.d
launcher = STEAM_COMPAT.joinpath("ULWGL-Launcher")
if launcher.is_dir():
rmtree(str(launcher))

# $HOME/.cache
launcher = home.joinpath(".cache", "ULWGL")
if launcher.is_dir():
rmtree(str(launcher))

# $HOME/.local/share
launcher = home.joinpath(".local", "share", "ULWGL")
if launcher.is_dir():
rmtree(str(launcher))


@contextmanager
def https_connection(host: str):
"""Create an HTTPSConnection."""
Expand Down

0 comments on commit 3aee061

Please sign in to comment.