ulwgl_run: prefer using .joinpath for path segments

Co-authored-by: Stelios Tsampas <loathingkernel@gmail.com>
This commit is contained in:
R1kaB3rN 2024-02-18 10:40:44 -08:00
parent af5b50da49
commit 9a3c07d792
No known key found for this signature in database

View File

@ -45,7 +45,7 @@ example usage:
def setup_pfx(path: str) -> None: def setup_pfx(path: str) -> None:
"""Create a symlink to the WINE prefix and tracked_files file.""" """Create a symlink to the WINE prefix and tracked_files file."""
pfx: Path = Path(path + "/pfx").expanduser() pfx: Path = Path(path).joinpath("pfx").expanduser()
if pfx.is_symlink(): if pfx.is_symlink():
pfx.unlink() pfx.unlink()
@ -53,7 +53,7 @@ def setup_pfx(path: str) -> None:
if not pfx.is_dir(): if not pfx.is_dir():
pfx.symlink_to(Path(path).expanduser()) pfx.symlink_to(Path(path).expanduser())
Path(path + "/tracked_files").expanduser().touch() Path(path).joinpath("tracked_files").expanduser().touch()
def check_env( def check_env(
@ -241,8 +241,8 @@ def build_command(
) -> List[str]: ) -> List[str]:
"""Build the command to be executed.""" """Build the command to be executed."""
paths: List[Path] = [ paths: List[Path] = [
Path(Path().home().as_posix() + "/.local/share/ULWGL/ULWGL"), Path.home().joinpath(".local/share/ULWGL/ULWGL"),
Path(Path(__file__).parent.as_posix() + "/ULWGL"), Path(__file__).parent.joinpath("ULWGL"),
] ]
entry_point: str = "" entry_point: str = ""
verb: str = env["PROTON_VERB"] verb: str = env["PROTON_VERB"]
@ -255,20 +255,24 @@ def build_command(
# Raise an error if the _v2-entry-point cannot be found # Raise an error if the _v2-entry-point cannot be found
if not entry_point: if not entry_point:
home: str = Path().home().as_posix() home: str = Path.home().as_posix()
dir: str = Path(__file__).parent.as_posix() dir: str = Path(__file__).parent.as_posix()
msg: str = ( msg: str = (
f"Path to _v2-entry-point cannot be found in: {home}/.local/share or {dir}" f"Path to _v2-entry-point cannot be found in: {home}/.local/share or {dir}"
) )
raise FileNotFoundError(msg) raise FileNotFoundError(msg)
if not Path(env.get("PROTONPATH") + "/proton").is_file(): if not Path(env.get("PROTONPATH")).joinpath("proton").is_file():
err: str = "The following file was not found in PROTONPATH: proton" err: str = "The following file was not found in PROTONPATH: proton"
raise FileNotFoundError(err) raise FileNotFoundError(err)
command.extend([entry_point, "--verb", verb, "--"]) command.extend([entry_point, "--verb", verb, "--"])
command.extend( command.extend(
[Path(env.get("PROTONPATH") + "/proton").as_posix(), verb, env.get("EXE")] [
Path(env.get("PROTONPATH")).joinpath("proton").as_posix(),
verb,
env.get("EXE"),
]
) )
if opts: if opts: