Skip to content

Commit af220cb

Browse files
authored
Merge pull request #222 from R1kaB3rN/delete-rc4-files
fix: remove 0.1-rc4 files for users
2 parents 1969deb + 00ff4ab commit af220cb

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

umu/umu_util.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77
from re import Pattern
88
from re import compile as re_compile
9-
from shutil import which
9+
from shutil import rmtree, which
1010
from ssl import SSLContext, create_default_context
1111
from subprocess import PIPE, STDOUT, Popen, TimeoutExpired
1212

@@ -183,26 +183,33 @@ def find_obsolete() -> None:
183183
"umu_version.json",
184184
"sniper_platform_0.20231211.70175",
185185
}
186+
launcher: Path
186187

187188
# Obsoleted files in $HOME/.local/share/umu from RC4 and below
188189
for file in UMU_LOCAL.glob("*"):
189190
is_umu_file: bool = file.name.endswith(".py") and (
190191
file.name.startswith(("umu", "ulwgl"))
191192
)
192193
if is_umu_file or file.name in obsoleted:
193-
log.warning("'%s' is obsolete", file)
194+
if file.is_file():
195+
file.unlink()
196+
if file.is_dir():
197+
rmtree(str(file))
194198

195199
# $HOME/.local/share/Steam/compatibilitytool.d
196-
if (launcher := STEAM_COMPAT.joinpath("ULWGL-Launcher")).is_dir():
197-
log.warning("'%s' is obsolete", launcher)
200+
launcher = STEAM_COMPAT.joinpath("ULWGL-Launcher")
201+
if launcher.is_dir():
202+
rmtree(str(launcher))
198203

199204
# $HOME/.cache
200-
if (cache := home.joinpath(".cache", "ULWGL")).is_dir():
201-
log.warning("'%s' is obsolete", cache)
205+
launcher = home.joinpath(".cache", "ULWGL")
206+
if launcher.is_dir():
207+
rmtree(str(launcher))
202208

203209
# $HOME/.local/share
204-
if (ulwgl := home.joinpath(".local", "share", "ULWGL")).is_dir():
205-
log.warning("'%s' is obsolete", ulwgl)
210+
launcher = home.joinpath(".local", "share", "ULWGL")
211+
if launcher.is_dir():
212+
rmtree(str(launcher))
206213

207214

208215
@contextmanager

0 commit comments

Comments
 (0)