Skip to content

Commit

Permalink
Log warnings for obsoleted files (#131)
Browse files Browse the repository at this point in the history
* Warn about obsoleted launcher files

* umu_util: remove warning for umu-launcher

* umu_util: make precedence clear in expressions

* umu_util: update logic

* umu_util: create path for home directory

* umu_util: update comment
  • Loading branch information
R1kaB3rN authored Jul 26, 2024
1 parent 0a1ad97 commit b0a1ca1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion umu/umu_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

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

client_session: HTTPSConnection = HTTPSConnection(
"repo.steampowered.com",
Expand Down Expand Up @@ -186,6 +186,7 @@ def setup_umu(
_install_umu(json, thread_pool)
return

find_obsolete()
_update_umu(local, json, thread_pool)


Expand Down
33 changes: 33 additions & 0 deletions umu/umu_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from shutil import which
from subprocess import PIPE, STDOUT, Popen, TimeoutExpired

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


Expand Down Expand Up @@ -124,3 +125,35 @@ def is_winetricks_verb(
return False

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",
}

# 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:
log.warning("'%s' is obsolete", file)

# $HOME/.local/share/Steam/compatibilitytool.d
if (launcher := STEAM_COMPAT.joinpath("ULWGL-Launcher")).is_dir():
log.warning("'%s' is obsolete", launcher)

# $HOME/.cache
if (cache := home.joinpath(".cache", "ULWGL")).is_dir():
log.warning("'%s' is obsolete", cache)

# $HOME/.local/share
if (ulwgl := home.joinpath(".local", "share", "ULWGL")).is_dir():
log.warning("'%s' is obsolete", ulwgl)

0 comments on commit b0a1ca1

Please sign in to comment.