|
6 | 6 | from pathlib import Path
|
7 | 7 | from re import Pattern
|
8 | 8 | from re import compile as re_compile
|
9 |
| -from shutil import which |
| 9 | +from shutil import rmtree, which |
10 | 10 | from ssl import SSLContext, create_default_context
|
11 | 11 | from subprocess import PIPE, STDOUT, Popen, TimeoutExpired
|
12 | 12 |
|
@@ -183,26 +183,33 @@ def find_obsolete() -> None:
|
183 | 183 | "umu_version.json",
|
184 | 184 | "sniper_platform_0.20231211.70175",
|
185 | 185 | }
|
| 186 | + launcher: Path |
186 | 187 |
|
187 | 188 | # Obsoleted files in $HOME/.local/share/umu from RC4 and below
|
188 | 189 | for file in UMU_LOCAL.glob("*"):
|
189 | 190 | is_umu_file: bool = file.name.endswith(".py") and (
|
190 | 191 | file.name.startswith(("umu", "ulwgl"))
|
191 | 192 | )
|
192 | 193 | 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)) |
194 | 198 |
|
195 | 199 | # $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)) |
198 | 203 |
|
199 | 204 | # $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)) |
202 | 208 |
|
203 | 209 | # $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)) |
206 | 213 |
|
207 | 214 |
|
208 | 215 | @contextmanager
|
|
0 commit comments