refactor: joining path not str

This commit is contained in:
Дмитрий Абдрахманов 2024-10-09 16:10:15 +03:00
parent 7bd485ffe6
commit f1d6e154f9

View File

@ -9,22 +9,22 @@ from pathlib import Path
def install(parsed) -> None:
args = parsed.parse_args()
if args.install:
projectDir = str(Path(__file__).resolve().parent.parent)
projectDir = Path(__file__).resolve().parent.parent
homeDir = os.getenv("HOME")
serviceDirExist = os.path.isdir(homeDir + "/.config/systemd/user/")
delivered = False
if serviceDirExist:
delivered = filecmp.cmp(
projectDir + "/services/wthrc.service",
os.path.join(projectDir, "services/wthrc.service"),
homeDir + "/.config/systemd/user/wthrc.service",
shallow=True,
)
if not delivered or not serviceDirExist:
os.environ["DIR"] = projectDir
subprocess.call(["sh", projectDir + "/scripts/install.sh"])
subprocess.call(["sh", projectDir + "/scripts/runner.sh"])
subprocess.call(["sh", os.path.join(projectDir, "scripts/install.sh")])
subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")])
sleep(5)
else: