|
1 | 1 | from sys import version
|
2 | 2 | from tarfile import open as tar_open, TarInfo
|
3 |
| -from os import environ |
| 3 | +from os import environ, access, W_OK |
4 | 4 | from umu_consts import CONFIG, UMU_LOCAL
|
5 | 5 | from typing import Any
|
6 | 6 | from collections.abc import Callable
|
|
16 | 16 | from concurrent.futures import ThreadPoolExecutor, Future
|
17 | 17 | from hashlib import sha256
|
18 | 18 | from subprocess import run
|
| 19 | +from stat import S_IWUSR |
19 | 20 |
|
20 | 21 | SSL_DEFAULT_CONTEXT: SSLContext = create_default_context()
|
21 | 22 |
|
@@ -172,13 +173,20 @@ def _install_umu(root: Path, local: Path, json: dict[str, Any]) -> None:
|
172 | 173 | defined at build time, with the exception of umu-launcher which will be
|
173 | 174 | installed in $PREFIX/share/steam/compatibilitytools.d
|
174 | 175 | """
|
| 176 | + json_local: Path = local.joinpath(CONFIG) |
| 177 | + |
175 | 178 | log.debug("New install detected")
|
176 | 179 | log.console("Setting up Unified Launcher for Windows Games on Linux ...")
|
177 | 180 | local.mkdir(parents=True, exist_ok=True)
|
178 | 181 |
|
179 | 182 | # Config
|
180 | 183 | log.console(f"Copied {CONFIG} -> {local}")
|
181 |
| - copy(root.joinpath(CONFIG), local.joinpath(CONFIG)) |
| 184 | + copy(root.joinpath(CONFIG), json_local) |
| 185 | + |
| 186 | + # Ensure the config file is writable for the owner after copied |
| 187 | + # See https://github.com/Open-Wine-Components/umu-launcher/issues/106 |
| 188 | + if not access(local.joinpath(CONFIG), W_OK): |
| 189 | + json_local.chmod(json_local.stat().st_mode | S_IWUSR) |
182 | 190 |
|
183 | 191 | # Runtime platform
|
184 | 192 | setup_runtime(json)
|
|
0 commit comments